Docker My Note

In this tutorial, I am written Docker my note. Docker the essential for DevOps Roles.

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Solve the problem: Add this user to the docker group.

Detach and Attach

  • Detach : Ctrl-p + Ctrl-q
  • Attach : docker attach [container]

Why can not detach?

Solve the problem: docker run with “-i”, “-t” options.

Docker run without -it, but attach, so can not type CTRL-C

Close your terminal! Anything OK.

To safe detach…

Docker run without “-i”, “-t” option. But you want to detach, if you hit Ctrl-C then docker process be killed.
To avoid it, attach with


You want to log in a container…

docker exec -it [container-name] /bin/bash

start on os-startup

docker command


docker compose add restart: always in docker-compose.yaml file

search a docker image in

docker search nginx

Download a docker image from

docker image pull <image_name>:<image_version/tag>

List out docker images from your local system

docker image ls

Expose your application to host server

docker run -d -p <host_port>:<container_port> --name <container_Name> <image_name>:<Image_version/tag>

List out running containers

docker ps

List out all docker container (running, stpooed, terminated, etc…)

docker ps -a

Stop/Start a container

docker stop <container_id>

docker start <container_id>

Remove a container

docker rm <container_id>

Docker My Note. I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.