Difference between revisions of "Docker"

From DUNE
Jump to navigation Jump to search
Line 18: Line 18:
 
* system prune
 
* system prune
  
=Restart=
+
=System Configuration=
 +
After configuration changes, a restart is usually needed:
 
<pre>
 
<pre>
 
sudo service docker restart
 
sudo service docker restart
 
</pre>
 
</pre>
 +
 +
In firewall/restricted environments, the following needs to be in
 +
the /etc/docker/daemon.json file (put in your specific DNS):
 +
<pre>
 +
{
 +
    "dns":["my.dns.ip.address"]
 +
}
 +
</pre>
 +
 +
This should work, but in some other cases the file /etc/default/docker
 +
may need to be tweaked, specifically the OPTS.

Revision as of 16:13, 25 April 2019

Location of Image Files

The contents of the /var/lib/docker directory vary depending on the driver Docker is using for storage. By default this will be aufs but can fall back to overlay, overlay2, btrfs, devicemapper or zfs depending on your kernel support. In most places this will be aufs but the RedHats went with devicemapper.

Basic Commands

All commands below need to be prepended by "sudo docker":

  • images
  • rmi (or rmi -f if simple image delete fails)
  • ps -a
  • container ls
  • stop [ -t delay ] my_container

The docker system prune command will remove all stopped containers, all dangling images, and all unused networks:

  • system prune

System Configuration

After configuration changes, a restart is usually needed:

sudo service docker restart

In firewall/restricted environments, the following needs to be in the /etc/docker/daemon.json file (put in your specific DNS):

{
    "dns":["my.dns.ip.address"]
}

This should work, but in some other cases the file /etc/default/docker may need to be tweaked, specifically the OPTS.