Docker command workflow: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
(Created page with "Following slide show a high level Docker commands from Dockerfile to Dockerhub or private Dockerhub. {| class="wikitable" |+ !commands !State from !State to !Example !Notes |- |build/compose |Dockerfile or compose file |docker image |build docker image from source | |- |run |docker image |docker container |execute image as container | |- |commit |docker container |docker image |apply change in container to image | |- |stop/start/restart |docker container |docker contain...")
 
No edit summary
Line 56: Line 56:
|<code>docker import --change 'CMD ["/bin/bash"]' /pat/to/file.tar</code>  
|<code>docker import --change 'CMD ["/bin/bash"]' /pat/to/file.tar</code>  
|exported image is just one layer so need to define new Dockerfile or put start options with import --chanage options
|exported image is just one layer so need to define new Dockerfile or put start options with import --chanage options
|-
|push
|local image
|remote image
|docker tag
docker push
|login to hub then push
|-
|pull
|remote image
|local image
|docker pull
|pull remote hub image to local image
login required for private hub
|}
|}
[[File:Docker file2hub2.png|center|thumb|662x662px|Docker file to hub]]
[[File:Docker file2hub2.png|center|thumb|662x662px|Docker file to hub]]

Revision as of 17:04, 25 May 2023

Following slide show a high level Docker commands from Dockerfile to Dockerhub or private Dockerhub.

commands State from State to Example Notes
build/compose Dockerfile or compose file docker image build docker image from source
run docker image docker container execute image as container
commit docker container docker image apply change in container to image
stop/start/restart docker container docker container start/stop/restart container
save docker image tarball docker save IMAGE > /path/to/file.tardocker save -o /path/to/file.tar IMAGE
load tarball docker image docker load /path/to/file.tar
export docker container tarball docker export CONTAINER > /path/to/file.tardocker export -o /path/to/file.tar CONTAINER Export without history and metadata
import tarball docker import --change 'CMD ["/bin/bash"]' /pat/to/file.tar exported image is just one layer so need to define new Dockerfile or put start options with import --chanage options
push local image remote image docker tag

docker push

login to hub then push
pull remote image local image docker pull pull remote hub image to local image

login required for private hub

Docker file to hub

References