Skip to content

Docker CE installation on Centos Box

Step-1: EPEL release Repo

[code lang=”bash”]
$ sudo yum install -y epel-release
[/code]

 

Step-2: Remove Older Docker version if installed

[code lang=”bash”]
$ sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine
[/code]

 

Step-3: SET UP THE REPOSITORY

[code lang=”bash”]
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
[/code]

Step-4: Set up the stable repository

[code lang=”bash”]
$ sudo yum-config-manager \
–add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
[/code]

 

Step-5: INSTALL DOCKER CE

[code lang=”bash”]
$ sudo yum install docker-ce
[/code]

 

Step-6: Start Docker

[code lang=”bash”]
$ sudo systemctl start docker
[/code]

 

Step-7: Uninstall Docker CE

[code lang=”bash”]
$ sudo yum remove docker-ce
[/code]

 

Step-8: Removing Images, containers, volumes, or customized configuration files

[code lang=”bash”]
$ sudo rm -rf /var/lib/docker
[/code]

 

Step-9: Manage Docker as a non-root user

[code lang=”bash”]
# Create the docker group.
$ sudo groupadd docker

# Add your user to the docker group
$ sudo usermod -aG docker $USER
[/code]

 

Step-10: Permission Denied Error

[code lang=”bash”]
# WARNING: Error loading config file: /home/user/.docker/config.json -stat /home/user/.docker/config.json: permission denied

$ sudo chown “$USER”:”$USER” /home/”$USER”/.docker -R
$ sudo chmod g+rwx “/home/$USER/.docker” -R
[/code]

Step-11: Permission Denied – Connect – Daemon Socket

[code lang=bash]

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http:///var/run/docker.sock/v1.26/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See ‘docker run –help’.

$ sudo usermod -a -G docker $USER

[/code]

 

Step-12: Configure Docker to start on boot

[code lang=”bash”]
$ sudo systemctl enable docker
[/code]

 

Shashi View All

-== Superman ==-

Leave a Reply

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

%d bloggers like this: