Difference between revisions of "Docker"
From Athenaeum
(→Defense of Baseimage) |
(→Docker Install) |
||
Line 8: | Line 8: | ||
#echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" > /etc/apt/sources.list.d/docker.list | #echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" > /etc/apt/sources.list.d/docker.list | ||
#aptitude update | #aptitude update | ||
− | #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) | + | #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 Version | grep -i $(curl -s https://api.github.com/repos/docker/docker-ce/releases/latest | jq -r ".name") | cut -d " " -f 2-3 | head -1) |
#aptitude hold docker-ce | #aptitude hold docker-ce | ||
#usermod -a -G docker $USER | #usermod -a -G docker $USER |
Latest revision as of 14:01, 24 March 2019
Random
Erase a container's logs:truncate -s 0 /var/lib/docker/containers/$id/$id-json.log
Docker Install
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" > /etc/apt/sources.list.d/docker.list
- aptitude update
- 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 Version | grep -i $(curl -s https://api.github.com/repos/docker/docker-ce/releases/latest | jq -r ".name") | cut -d " " -f 2-3 | head -1)
- aptitude hold docker-ce
- 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
Defense of Baseimage
- Under certain circumstances when launching a container with -it the main application will not run. You must then execute the command manually. This does not happen with baseimage because of my_init.
- Many containers are missing basic diagnostic functionality like procps which provides the 'ps' command. This is instrumental in diagnosing whether an application is running correctly since docker does not rely on startup scripts.