tipe: we can have a lot of containers base on an image
run a docker image. it download image if not present in local
sudo docker run hello-world list all docker images
sudo docker imagesshow all previously run container
sudo docker ps -adownload a docker image from hub.docker.com
sudo docker pull hello-worldrun a docker image and then run the echo command from the created container
sudo docker run busybox echo "Hello from busybox"Send stop signal to busybox container and wait for 30 seconds then if it still running kill the process
docker stop --time=30 busyboxremove previously created container by it is number (648795252)
sudo docker rm 648795252remove docker image by it is name
sudo docker rmi hello-worldremove all previously created docker containers
sudo docker container prunerun docker image and after it finished remove the container
sudo docker run --rm hello-worldRun docker image and give me the interactive shell inside the container
sudo docker run -it hello-worldGive me the interactive shell inside the container with bash
docker exec -it hello-world bashExecute a command in a running container
sudo docker exec 648795252 touch "/hi"Run the Redis image and map port 6379 on the container to 100 in the host OS
sudo docker run -p100:6379 rediscreate a name for container to access it without it's number
sudo docker run --name hello hello-worldrun image in background (daemon)
sudo docker run -d hello-worldMap /data in container to /tmp/data in host os, this way we can create persistent storage for redis
sudo docker run redis -v /tmp/data/redis:/dataCreate an image from a docker file in current directory
sudo docker build .Build image and add tag, version to it
sudo docker build -t myapp:v1 .Show already created docker network
sudo docker network lscreate a network with mynet name
sudo docker network create mynetworkrun a docker image and use mynet network this way running docker container can access other containers with thir name
docker run redis --network mynet