Install docker on cent os 7

  • By Lehbot
  • Fri 27 January 2017

If you want to install docker on Cent OS 7, don't use the binaries out of the extras repo from centos.

What you get is a different named docker daemon binary, with /usr/bin/dockerd-current instead of /usr/bin/dockerd and also /usr/bin/docker-proxy is missing.

Follow the instructions on: https://docs.docker.com/engine/installation/linux/centos/

In short what i did was:

When you installed docker before: yum -y remove docker-*

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo     https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo
sudo yum makecache fast
yum install docker-engine --disablerepo=extras

Initially what i wanted to do is expose the default docker port 2375 for testing around with portainer (portainer.io)

I then was able to create a file under /etc/systemd/system/docker.service.d (folder docker.service.d must be created first):

vi docker.conf with the content:

[Service]
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
ExecStart=
ExecStart=/usr/bin/dockerd -D -H tcp://<your ip or 0.0.0.0>:2375

After that you need to connect from your local or a remote workstation via:

docker -H tcp://<ip address>:2375 <some commands like ps>

!!! Attention: By opening this port everyone is able to manage this docker host without authentication. So secure your environment !!!