Docker
Searching anĀ Image
docker search <img-name>
Renaming a Container
docker rename <old-name> <new-name>
Docker hub
Pull a Image
docker pull <image>:<version>
List Images
docker images
Run a Container
docker run -it <img-name> /bin/bash
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 with ports + volume
docker run --name my_name -d -p 80:80 -v /data/websites:/var/www
(-v = volume, -p = port, -d = detach)
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 to a tar.gz file
docker import container.tar <container-name>.
Start containers automatically
systemctl enable docker
docker run -dit --restart unless-stopped nginx
docker exec -it nginx bash
docker top nginx