docker-ce Archives - Justin Silver https://www.justinsilver.com/tag/docker-ce/ Technology, Travel, and Pictures Thu, 28 Mar 2019 22:57:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.1 https://www.justinsilver.com/wp-content/uploads/2013/06/cropped-apple-touch-icon-160x160.png docker-ce Archives - Justin Silver https://www.justinsilver.com/tag/docker-ce/ 32 32 Docker-CE on CentOS 7 https://www.justinsilver.com/technology/linux/docker-ce-on-centos-7/?utm_source=rss&utm_medium=rss&utm_campaign=docker-ce-on-centos-7 https://www.justinsilver.com/technology/linux/docker-ce-on-centos-7/#respond Thu, 28 Mar 2019 14:48:29 +0000 https://www.justinsilver.com/?p=4815 Install Docker-CE (not just “docker) to get the latest version on CentOS. Update firewalld to allow host/container traffic. Restart firewalld to pick up the changes. Create a group named “docker” and add any users...

The post Docker-CE on CentOS 7 appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

Install Docker-CE (not just “docker) to get the latest version on CentOS.

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum install -y docker-ce
chkconfig docker on
service docker start

Update firewalld to allow host/container traffic.

Restart firewalld to pick up the changes.

# trust the docker interface
firewall-cmd --permanent --zone=trusted --change-interface=docker0
# accept IPv4 traffic
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 4 -i docker0 -j ACCEPT
# any ports on the host you want to access from the containers (strapi port 1337 here)
firewall-cmd --permanent --zone=trusted --add-port=1337/tcp
firewall-cmd --reload
service docker restart

Create a group named “docker” and add any users that are allowed to create containers.

groupadd docker
# allow users to access docker by adding them to the docker group
# usermod -aG docker $USER

Use an entrypoint file to create an entry in /etc/hosts to point to the host. Requires ping and ip on the machine, on Debian these are found in the apt packages inetutils-ping and iproute.

#!/bin/bash

# fix for linux hosts
HOST_DOMAIN="host.docker.internal"
ping -q -c1 $HOST_DOMAIN > /dev/null 2>&1
if [ $? -ne 0 ]; then
  HOST_IP=$(ip route | awk 'NR==1 {print $3}')
  echo -e "$HOST_IP\t$HOST_DOMAIN" >> /etc/hosts
fi

exec "$@"

The post Docker-CE on CentOS 7 appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/docker-ce-on-centos-7/feed/ 0