Difference between revisions of "Docker"

From Michael's Information Zone
Jump to navigation Jump to search
Line 19: Line 19:
 
</pre>
 
</pre>
 
Or even better, just use the 'z' flag for mounting volumes.<ref>http://jaormx.github.io/2018/selinux-and-docker-notes/</ref>
 
Or even better, just use the 'z' flag for mounting volumes.<ref>http://jaormx.github.io/2018/selinux-and-docker-notes/</ref>
 +
<pre>
 +
docker run --name steamcache --restart=always -d -v /raid5/archive/steamcache:/data/cache:z -v /raid5/archive/steamcache/logs:/data/logs:z --network=steam -p 192.168.11.200:80:80 steamcache/monolithic:latest
 +
</pre>

Revision as of 19:33, 8 July 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

Or even better, just use the 'z' flag for mounting volumes.[3]

docker run --name steamcache --restart=always -d -v /raid5/archive/steamcache:/data/cache:z -v /raid5/archive/steamcache/logs:/data/logs:z --network=steam -p 192.168.11.200:80:80 steamcache/monolithic:latest