docker_cheat_sheet
This is an old revision of the document!
Docker Check Sheet
Getting Started
docker run --name repo alpine/git ` clone https://github.com/docker/getting-started.git | Clone |
docker cp repo:/git/getting-started/ . | Clone |
cd getting-started | |
docker build -t docker101tutorial . | Build |
docker run -d -p 80:80 --name docker-tutorial docker101tutorial | Run-d - run the container in detached mode (in the background)-p 80:80 - map port 80 of the host to port 80 in the containerdocker/getting-started - the image to use |
docker ps | List running Docker processes. |
docker stop 6307dc32ab8e | Stop a Docker process. |
docker rm 6307dc32ab8e | Delete a Docker process. |
docker rm -f 6307dc32ab8e | Stop and delete a Docker process.-f - force |
docker exec aab6865570a6 cat /data.txt | Run the cat/data.txt command inside a running Docker process. |
docker volume create todo-db | Create a volume called todo-db . |
docker network create todo-app | Create a network called todo-app . |
docker run -d ` --network todo-app --network-alias mysql ` -v todo-mysql-data:/var/lib/mysql ` -e MYSQL_ROOT_PASSWORD=secret ` -e MYSQL_DATABASE=todos ` mysql:5.7 | Start a MySQL container and attach it to the network. Set a couple of variables. |
docker exec -it <mysql-container-id> mysql -p | Connect to the MySQL database. |
docker_cheat_sheet.1635973629.txt.gz · Last modified: 2021/11/04 22:07 (external edit)