- Docker CE vs Docker EE
- Install using repository vs Install from a package
Here is a list of the basic commands from this page, and some related ones if you’d like to explore a bit before moving on.
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker ps # See a list of all running containers
docker stop <hash> # Gracefully stop the specified container
docker ps -a # See a list of all containers, even the ones not running
docker kill <hash> # Force shutdown of the specified container
docker rm <hash> # Remove the specified container from this machine
docker rm $(docker ps -a -q) # Remove all containers from this machine
docker images -a # Show all images on this machine
docker rmi <imagename> # Remove the specified image from this machine
docker rmi $(docker images -q) # Remove all images from this machine
docker login # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag # Tag <image> for upload to registry
docker push username/repository:tag # Upload tagged image to registry
docker run username/repository:tag # Run image from a registry
-
How to copy docker images from one host to another without via repository?
utilize
docker save & load
for image anddocker export & import
for containerdocker save xxx_image_name:tags | gzip > ~/xxx-tags.tar.gz gzip -cd xxx-tags.tar.gz | docker load docker export xxx_container_name | gzip > ~/xxx.tar.gz gzip -cd xxx.tar.gz | docker import - xxx_image_name:tags # exported container & re-import as image
-
docker rmi <your_name>/<image_name>:<tag>
remove a tag;docker rmi <image_id>
remove a image -
Dockerfile: RUN vs CMD vs ENTRYPOINT?
-
To remove dangling images:
docker images -f "dangling=true" -q|xargs docker rmi
-
Get container IP:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
-
utilize
docker logs
for debugging