DekGenius.com
SHELL
Tech-Chat github karshunibremen
# enable swarm feature in docker
docker swarm init
Tech-Chat github karshunibremen
# docker manager join token
docker swarm join-manager manager
Tech-Chat github karshunibremen
# docker service create
docker service create <image-name> <option>
# example
docker service create alpine ping 8.8.8.8
Tech-Chat github karshunibremen
# force container to remove
docker container rm -f <container id>
Tech-Chat github karshunibremen
# inspect about a docker image
docker image inspect <image-name>
Tech-Chat github karshunibremen
# get history of a image
docker history <image-name>
Tech-Chat github karshunibremen
# docker pull an image
docker pull <image-name>:<version>
Tech-Chat github karshunibremen
# docker list images
docker image ls
Tech-Chat github karshunibremen
# docker connect to already existing network
docker network connect <network-id> <container-id>
Tech-Chat github karshunibremen
# docker create network
docker network create <name-of-network>
Tech-Chat github karshunibremen
# docker network list
docker network ls
Tech-Chat github karshunibremen
# checking port map in a docker container
docker container port <container-name>
Tech-Chat github karshunibremen
# run bash in already running container in parallel
docker container exec -it <container-name> bash
Tech-Chat github karshunibremen
# run bash shell in a docker container
docker container run -it --name <your_choice> <image_name> bash
Tech-Chat github karshunibremen
# get docker stats on a container
docker container stats <container-name>
Tech-Chat github karshunibremen
# get docker statistics on resources
docker container stats
Tech-Chat github karshunibremen
# list containers in docker
docker container ps -a
Tech-Chat github karshunibremen
# remove container from docker
docker container rm <first 3 characters of container id>
Tech-Chat github karshunibremen
# syntax for docker container run
docker container run --publish <host-port>:<container-port> --detach --name <unique name of your choice> nginx
Tech-Chat github karshunibremen
# docker run example with detach
docker container run -p 80:80 --detach nginx
Tech-Chat github karshunibremen
# docker run example with nginx
docker container run -p 80:80 nginx
Tech-Chat github karshunibremen
# docker logout
docker logout
Tech-Chat github karshunibremen
# docker user login
docker login
Tech-Chat github karshunibremen
# get docker version
docker version
Tech-Chat github karshunibremen
# adding user mod to docker or adding user to docker
sudo usermod -aG docker <username>
Tech-Chat github karshunibremen
# docker node update role
docker node update --role <manager/worker> <node-name>
#Example
docker node update --role manager node2
Tech-Chat github karshunibremen
# docker service update service with replicas/ scaling
docker service update <service-id/service-name> --replicas <count>
#Example
docker service update mqtt_client --replicas 3
Tech-Chat github karshunibremen
# docker service list node
docker service ls
Tech-Chat github karshunibremen
#docker service create with replicas
docker service create --replicas <count> <image-name> <option>
# example
docker service create --replicas 3 alpine ping 8.8.8.8
Tech-Chat github karshunibremen
Tech-Chat github karshunibremen
# docker build images
docker build -f <path-to-Dockerfile> .
© 2022 Copyright:
DekGenius.com