Skip to content

Commit 6cc72bb

Browse files
committed
docker
1 parent c15d720 commit 6cc72bb

File tree

6 files changed

+67
-69
lines changed

6 files changed

+67
-69
lines changed

docker/docker-cheat-sheet.txt

Lines changed: 0 additions & 69 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docker/readme.txt

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Docker Cheat Sheet:
2+
3+
Docker Containers
4+
docker search # search the images in docker hub
5+
docker pull # pull image from docker hub
6+
docker images # list the images in local
7+
docker run (interactive / detached ) # run a container from an image
8+
docker ps # list the running containers
9+
docker ps -a # list running + exited containers
10+
docker inspect # inspect a container
11+
docker stop|start|restart # stop/start/restart a container
12+
docker rm / docker rm -f # remove the containers from the server
13+
docker exec # get inside a running container
14+
15+
Docker Images
16+
docker images # list images in local
17+
docker commit ( manual ) # create image from container changes
18+
docker build ( automated ) # create image using a dockerfile
19+
docker history # view the layers of an image
20+
docker inspect # inspect an image
21+
docker rmi # remove image from local
22+
23+
image repository
24+
docker hub (public) # docker image reporsitory
25+
docker registry container (private) # docker image repository open source
26+
DTR (priviate) # docker image repository licensed tool from docker org
27+
docker login # login to image repo from commad line
28+
docker tag # create alias name for an image in local
29+
docker push # push images to docker image repository
30+
31+
Docker Volumes
32+
docker volume ls # list volumes in local
33+
docker volume create # create a volume
34+
docker inspect volume # inspect the volume
35+
36+
Docker COMPOSE:
37+
38+
case 1: deploy multiple containers from a single image
39+
docker-compose -f docker-compose.yml up --scale web=4 -d ; docker-compose down
40+
case 2: deploy multiple containers from multiple images
41+
docker-compose -f docker-compose.yml -p webapps up -d --scale web=2 --scale app=2
42+
43+
44+
Docker Networking:
45+
docker network ls # list the default & custom networks on a docker host
46+
none|host|bridge|overlay|docker_gwbridge
47+
docker network create -d <driver> <network name> # create a custom network of bridge/overlay
48+
docker run -d --net host --name cont1 alpine # attach a continer to host network
49+
docker run -d --net none --name cont2 alpine # attach a container to none network
50+
docker run -d --net ravinet --name cont3 alpine # attache a container to custom bridge/overlay network
51+
52+
Docker Swarm
53+
54+
docker swarm init ## initialize the swarm mode (swarm manager)
55+
docker swarm join ## join a node to manager as worker / manager
56+
docker swarm join-token worker/manager ## generate worker/manager token
57+
docker swarm leave ## run on worker nodes to leave the node from swarm
58+
59+
docker node ls ## list the node part of swarm
60+
docker node inspect ## inspect a node
61+
docker node rm <nodename> ## run on manager node to remove a node from swarm
62+
docker node ps ## List tasks running on one or more nodes, defaults to current node
63+
64+
docker service create ## create service in docker swarm cluster
65+
docker service ls ## list the running services
66+
docker service ps <service name> ## list the containers running inside a service
67+
docker service rm ## remove the service

0 commit comments

Comments
 (0)