Docker - Post install Tasks

Docker - Post-install steps

Manage Docker as a non-root user


Docker daemon binds to a Linux socket instead of a TCP port. By default that Unix socket is owned by the user "root" and other users can only access it using sudo. The docker daemon always runs as the root user.

To avoid using sudo , create a Unix group called docker and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker group.

The docker group grants privileges equivalent to the root user.

To create the docker group and add your user:

1. Create the docker group
sudo groupadd docker

2. Add your user to the docker group

 
sudo usermod -aG docker $USER

3.Logout and log back

4.Verify that you can run docker commands without sudo:

docker run hello-world

If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.

WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied
To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:

 
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

Configure Docker to start on boot


Most current Linux distributions (RHEL, CentOS, Fedora, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. Ubuntu 14.10 and below use upstart.
 
systemd

 sudo systemctl enable docker

To disable this behavior, use disable instead.

 sudo systemctl disable docker

upstart
Docker is automatically configured to start on boot using upstart. To disable this behavior, use the following command:

 
echo manual | sudo tee /etc/init/docker.override
chkconfig 
sudo chkconfig docker on

Comments

Unknown said…
Thanks for sharing this useful informative.I Got more information from this blog.Keep it up... Fixed Assets Audit
CFA Audit
CA Firms
Sherin infanta said…
Hi admin..... i have read your post.it was very useful.Thank you so much for sharing,Keep it up..... AR Customer Helpdesk
Duplicate Payment Recovery
Fraud Prevention
Ajish said…
This comment has been removed by a blog administrator.
sathyaramesh said…
This comment has been removed by a blog administrator.

Popular posts from this blog

Ansible 11 The uri module with examples

Jenkins Active choices parameter - Dynamic input

DevOps Weapons