- run hello world:
docker run hello-world
- complex image:
docker run -it danielkraic/asciiquarium
- get images:
docker iamges
- list containers:
docker ps
,docker ps -a
,docker container ls
- container runs and close:
docker run ubuntu
,docker run ubuntu echo hi
- check for it in the images:
docker iamges
- previously run containers:
docker ps -a
- keep running:
docker run ubuntu sleep 5
- run in interactive mode:
docker run -it ubuntu
- get a new image:
docker pull kodekloud/simple-webapp
- run the image:
docker run kodekloud/simple-webapp
- Hide logs(detached mode):
docker run -d kodekloud/simple-webapp
- check it:
docker ps
- attach the container to see logs(no logs?):
docker attach <ID>
- get the logs:
docker logs <ID>
- detach ubuntu:
docker run -d -it ubuntu
- exec ubuntu:
docker exec b2 echo hi
- inspect:
docker inspect <ID>
- remove the container:
docker rm <ID>
- map ports:
docker run -p 80:8080 kodekloud/simple-webapp
- get networks:
docker network ls
- view build history of an image:
docker history kodekloud/simple-webapp
- If you encountered this error
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json": dial unix /var/run/docker.sock: connect: permission denied
Just type: sudo chmod 666 /var/run/docker.sock