Docker Cheat Sheet

From Gejoreuy
Revision as of 09:41, 23 February 2020 by Gejor (talk | contribs)
Jump to navigation Jump to search

Run Container

 $ docker run -it centos

Run Container in Background

 $ docker run -t -d --name my_centos centos

Commit New Docker Image

 $ docker commit -m "your message" -a "author" [container-id] [new-image-name]

Change Docker Image Tag

 $ docker tag [old_image_name] <new_image_name]
 $ docker rmi [old_image_name]

Copy File from Host to Container

 $ docker cp foo.txt mycontainer:/foo.txt

Copy File from COntainer to Host

 $ docker cp mycontainer:/foo.txt foo.txt