Difference between revisions of "Basic Docker Command"

From Gejoreuy
Jump to navigation Jump to search
 
Line 32: Line 32:
 
    
 
    
 
   $ docker login https://registry.hub.docker.com/
 
   $ docker login https://registry.hub.docker.com/
 +
 +
'''Run Bash Inside Running Container'''
 +
 +
  $ docker exec -it [container_name] bash

Latest revision as of 15:23, 17 May 2020

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

Login to Docker Registry

 $ docker login https://registry.hub.docker.com/

Run Bash Inside Running Container

 $ docker exec -it [container_name] bash