CentOS7Docker: Difference between revisions
Jump to navigation
Jump to search
(added formatting to CentOS7Docker) |
(fix syntax highlight for CentOS7Docker) |
||
Line 1: | Line 1: | ||
=Add Docker YUM Repo= | =Add Docker YUM Repo= | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' | sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' | ||
[dockerrepo] | [dockerrepo] | ||
Line 13: | Line 13: | ||
=Install Docker= | =Install Docker= | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
sudo yum install -y docker-engine | sudo yum install -y docker-engine | ||
sudo mkdir /srv/docker | sudo mkdir /srv/docker | ||
Line 20: | Line 20: | ||
==Move standard mount point== | ==Move standard mount point== | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
sudo vi /etc/systemd/system/docker.service.d/graph.conf | sudo vi /etc/systemd/system/docker.service.d/graph.conf | ||
[Service] | [Service] | ||
Line 28: | Line 28: | ||
==Reload, enable, and start the daemon== | ==Reload, enable, and start the daemon== | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
sudo systemctl daemon-reload | sudo systemctl daemon-reload | ||
sudo systemctl enable docker.service | sudo systemctl enable docker.service | ||
Line 35: | Line 35: | ||
=Install EPEL for PIP= | =Install EPEL for PIP= | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
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 | ||
Line 41: | Line 41: | ||
==Install docker-compose via pip== | ==Install docker-compose via pip== | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
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 48: | Line 48: | ||
=Add docker group= | =Add docker group= | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
sudo groupadd docker | sudo groupadd docker | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Add user to group== | ==Add user to group== | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
useradd -m drew | useradd -m drew | ||
sudo usermod -aG docker drew | sudo usermod -aG docker drew | ||
Line 59: | Line 59: | ||
=Misc= | =Misc= | ||
<syntaxhighlight> | <syntaxhighlight lang=bash> | ||
docker ps | grep mongo # find container id | docker ps | grep mongo # find container id | ||
docker exec -t -i 7f71cedafaab bash | docker exec -t -i 7f71cedafaab bash |
Latest revision as of 22:50, 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