Skip to content

Instantly share code, notes, and snippets.

@jakebrinkmann
Last active May 8, 2017 05:10
Show Gist options
  • Save jakebrinkmann/10a79062cd11b26694ed09a0faeb3500 to your computer and use it in GitHub Desktop.
Save jakebrinkmann/10a79062cd11b26694ed09a0faeb3500 to your computer and use it in GitHub Desktop.
Setup Docker inside CentOS7 (using vagrant)

Setup Docker inside CentOS7

Just add a [dockerrepo] configuration to the /etc/yum.repos.d/docker.repo repository, and sudo yum install docker-engine. Start the docker daemon with sudo systemctl start docker, then following sudo docker run --rm hello-world a printout like the following is a very good sign:

Hello from Docker!
This message shows that your installation appears to be working correctly.

Avoid using sudo all the time by creating a docker group and adding users to it: sudo usermod -aG docker $(whoami)

To enable the daemon to run at bootup: sudo systemctl enable docker

Complete steps:

$ vagrant up
$ vagrant ssh
[vagrant@localhost ~]$ sudo yum install -y yum-utils
[vagrant@localhost ~]$ sudo yum-config-manager \
>     --add-repo \
>     https://download.docker.com/linux/centos/docker-ce.repo
[vagrant@localhost ~]$ sudo yum install docker-ce
[vagrant@localhost ~]$ sudo systemctl enable docker
[vagrant@localhost ~]$ sudo usermod -aG docker $(whoami)
[vagrant@localhost ~]$ sudo systemctl start docker
[vagrant@localhost ~]$ sudo docker run --rm hello-world
[vagrant@localhost ~]$ sudo yum install epel-release -y; sudo yum install -y python-pip
[vagrant@localhost ~]$ sudo pip install docker-compose
[vagrant@localhost ~]$ sudo yum upgrade python*
[vagrant@localhost ~]$ sudo curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
[vagrant@localhost ~]$ reboot
Password: vagrant
$ vagrant snapshot save DOCKERINSTALLED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment