Difference between revisions of "Docker"

From Athenaeum
Jump to: navigation, search
Line 1: Line 1:
 
[[category: Linux]]
 
[[category: Linux]]
 +
 +
=Random=
 +
Erase a container's logs: <pre>truncate -s 0 /var/lib/docker/containers/$id/$id-json.log</pre>
  
 
=Docker Install=
 
=Docker Install=

Revision as of 13:49, 30 January 2019


Random

Erase a container's logs:
truncate -s 0 /var/lib/docker/containers/$id/$id-json.log

Docker Install

  1. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  2. echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" > /etc/apt/sources.list.d/docker.list
  3. aptitude update
  4. For Kubernetes: aptitude install docker-ce=17.03.2~ce-0~ubuntu-xenial    or    For latest stable: aptitude install docker-ce=$(apt-cache show docker-ce | grep -i $(curl -s https://api.github.com/repos/docker/docker-ce/releases/latest | jq -r ".name") | cut -d " " -f 2-3 | head -1)
  5. aptitude hold docker-ce
  6. usermod -a -G docker $USER

Networking

To create a custom docker network on a host and avoid using --link:

docker network create --driver bridge testnet01