Docker
Docker hub
Searching anĀ Image
docker search <img-name>
Renaming a Container
docker rename <old-name> <new-name>
Pull a Image
docker pull <image>:<version>
List Images
docker images
List all Containers
docker ps -a
Commit a Image
docker commit <container-id> <name>
Delete a Container
docker rm <container-id>
Delete a Image
docker rmi <image-id>
Run a Container
docker run -it <img-name> /bin/bash
Run a Container with ports + volume
-v = volume, -p = port, -d = detach
docker run --name <name> -d -p 80:80 -v /data/websites:/var/www
Run a command inside container
docker exec -it <container-name> bash
Stop+Delete all Containers+Images
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -f status=exited -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
List Volumes
docker volume ls
Save image to a tar.gz file
docker save --output name.tar <container-name>
Import image from a tar.gz file
docker load < name.tar
Start containers automatically
systemctl enable docker
docker run -dit --restart unless-stopped <container-name>