Pull an image or repository from a registry
docker images
docker image ls
docker image rm [image-name]:[tag]
docker image rm [image-id]
Save an Image to a tar archive
docker save [image-name]:[tag] > [file.tar]
Load an Image from a tar archive
docker run -it --name [name] [image]:[tag] /bin/bash
docker run -it --name [name] -p [host-port]:[container-port] [image]:[tag] /bin/bash
docker run -it --name [name] --network [network-name] [image]:[tag] /bin/bash
docker run -it --name [name] -v [host-path]:[container-path] [image]:[tag] /bin/bash
docker run -it --name [name] --network [network-name] --volume [volume-name]:[container-path] [image]:[tag] /bin/bash
Display the Containers list
docker stop [container-name]
docker stop [container-id]
docker rm [container-name]
docker rm [container-id]
docker exec -it [container] /bin/bash
Create a new Image from a Container
docker commit [container] [image]:[tag]
Export an existing Container to a file
docker export [container] > [container].tar
Import an Image from a file
cat [container].tar | docker import - [image]:[tag]
docker network create [network-name]
Display the Networks list
Display more info about a Network
docker network inspect [network-name]
docker volume create [volume-name]
docker volume create --driver local --opt type=none --opt device=[path] --opt o=bind [volume-name]
Display more info about a Volume
docker volume inspect [volume-name]
Some installations for Containers
apt-get update
apt-get install net-tools
apt-get install iputils-ping
apt-get install vim
apt-get install nano
ping -c 5 [ip]
echo "text" > text.txt