Difference between revisions of "Docker"

From Michael's Information Zone
Jump to navigation Jump to search
Line 12: Line 12:
 
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
 
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
 
systemctl restart network
 
systemctl restart network
 +
</pre>
 +
==SELinux==
 +
Quick and dirty fix for mounting local volumes<ref>https://stackoverflow.com/questions/24288616/permission-denied-on-accessing-host-directory-in-docker</ref>
 +
<pre>
 +
chcon -Rt svirt_sandbox_file_t /directory/to/be/mounted
 
</pre>
 
</pre>

Revision as of 08:41, 6 April 2019

Building Containers

  • Build without working with cached data.
#!/bin/bash
docker build -t localphp:`date +%m%d%Y` -f Dockerfile --no-cache .
docker build -t localphp -f Dockerfile .

Networking

IP Forwarding

This is required to allow the containers to route out of the local docker network.[1]

echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
systemctl restart network

SELinux

Quick and dirty fix for mounting local volumes[2]

chcon -Rt svirt_sandbox_file_t /directory/to/be/mounted