Docker Cheat Sheet
Published on 24 Jun 2020
docker splash
The basic commands of Docker are, get an image, run and stop.
sudo docker pull scrapinghub/splash
sudo docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 scrapinghub/splash
sudo docker ps
sudo docker stop 55573ef3bf2a
sudo service docker stop
Other important commands are the ones that manage the network
docker network ls
docker network inspect bridge
docker run -itd --name=container1 busybox
docker run -itd --name=container2 busybox
docker network disconnect bridge container1
docker network create -d bridge new_bridge
docker run -d --net=new_bridge --name db training/postgres
docker exec -it db bash
ping ...
docker network connect new_bridge web
docker pull nginx aufs devicemapper overlay2 overlay zfs
docker info
/etc/docker/daemon.json
{
"storage-driver": "devicemapper"
}
service docker start
docker run -d -P --name web -v /webapp training/webapp python app.py
docker inspect web
Volumnes
Docker volumes act as a bridge connecting containers and the host’s file system, allowing seamless data sharing and persistence. They can be visualized as a shared folder 📂, where data can be read, written, and modified by both the container 📦 and the host machine 💻. Using volumes ensures data durability and portability, enabling easy migration and collaboration within the Docker ecosystem.
docker volume create --name a_volume
docker volume inspect a_volume
docker volume ls
docker volume prune
docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata
docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"
docker create -v /dbdata --name dbstore training/postgres /bin/true
docker run -d --volumes-from dbstore --name db1 training/postgres
docker run -d --volumes-from dbstore --name db2 training/postgres
all tags
IDE architecture" cli crontab crypto csv database docker editor error exceptions fastapi ffmpeg filename git go history http iteration javascript linux logging me mysql numpy orm pdo pentaho php postgres python random rename rsync rust selenium server solana sql sqlite ssh typescript user w3m wordpress