Docker command workflow: Difference between revisions
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 |
||
(One intermediate revision by the same user not shown) | |||
Line 53: | Line 53: | ||
|import | |import | ||
|tarball | |tarball | ||
| | |docker image | ||
|<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]] |
Latest revision as of 12:07, 26 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.tar docker 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.tar docker export -o /path/to/file.tar CONTAINER
|
Export without history and metadata |
import | tarball | docker image | 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 |