CentOS7Docker: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(Added CentOS7Docker)
 
(added formatting to CentOS7Docker)
Line 1: Line 1:
= Add yum repo =
 
=Add Docker YUM Repo=
<syntaxhighlight>
<syntaxhighlight>
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
Line 12: Line 13:


=Install Docker=
=Install Docker=
<syntaxhighlight>
sudo yum install -y docker-engine
sudo yum install -y docker-engine
sudo mkdir /srv/docker
sudo mkdir /srv/docker
sudo mkdir /etc/systemd/system/docker.service.d
sudo mkdir /etc/systemd/system/docker.service.d
</syntaxhighlight>


==Move standard mount point==
==Move standard mount point==
<syntaxhiglight>
<syntaxhighlight>
sudo vi /etc/systemd/system/docker.service.d/graph.conf
sudo vi /etc/systemd/system/docker.service.d/graph.conf
[Service]
[Service]
Line 25: Line 28:


==Reload, enable, and start the daemon==
==Reload, enable, and start the daemon==
<syntaxhightlight>
<syntaxhighlight>
sudo systemctl daemon-reload
sudo systemctl daemon-reload
sudo systemctl enable docker.service
sudo systemctl enable docker.service
sudo systemctl start docker
sudo systemctl start docker
</syntaxhightlight>
</syntaxhighlight>


=Install EPEL for PIP=
=Install EPEL for PIP=
Line 35: Line 38:
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum --disablerepo="*" --enablerepo="epel" install -y python-pip
sudo yum --disablerepo="*" --enablerepo="epel" install -y python-pip
</syntaxhightlight>
</syntaxhighlight>


==Install docker-compose via pip==
==Install docker-compose via pip==
<syntaxhightlight>
<syntaxhighlight>
yum upgrade python-*
yum upgrade python-*
sudo yum install -y git # not installed on minimal
sudo yum install -y git # not installed on minimal
Line 49: Line 52:
</syntaxhighlight>
</syntaxhighlight>


==Add user to group=
==Add user to group==
<syntaxhighlight>
<syntaxhighlight>
useradd -m drew
useradd -m drew

Revision as of 13:27, 24 January 2018

Add Docker YUM Repo

sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

Install Docker

sudo yum install -y docker-engine
sudo mkdir /srv/docker
sudo mkdir /etc/systemd/system/docker.service.d

Move standard mount point

sudo vi /etc/systemd/system/docker.service.d/graph.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --graph="/srv/docker" --storage-driver=overlay

Reload, enable, and start the daemon

sudo systemctl daemon-reload
sudo systemctl enable docker.service
sudo systemctl start docker

Install EPEL for PIP

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum --disablerepo="*" --enablerepo="epel" install -y python-pip

Install docker-compose via pip

yum upgrade python-*
sudo yum install -y git # not installed on minimal
sudo pip install docker-compose

Add docker group

sudo groupadd docker

Add user to group

useradd -m drew
sudo usermod -aG docker drew

Misc

docker ps | grep mongo # find container id
docker exec -t -i 7f71cedafaab bash
mongo 172.17.0.2/admin --eval 'db.getSiblingDB("dashboard").createUser({user: "db", pwd: "dbpass", roles: [{role: "readWrite", db: "dashboard"}]})'
^ change to localhost