jueves, 29 de noviembre de 2018

docker install debian stretch 2018


root@educacion:~# apt update

root@educacion:~# apt install \
     apt-transport-https \
     ca-certificates \
     curl \
     gnupg2 \
     software-properties-common

root@educacion:~# curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

root@educacion:~# apt-key fingerprint 0EBFCD88

root@educacion:~# add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

root@educacion:~# apt update

root@educacion:~# apt upgrade

root@educacion:~# apt install docker-ce

root@educacion:~# docker run hello-world

-( root@educacion:~# apt install docker-compose ) # OLD release of docker-compose, we must install from git repo
-( root@educacion:~# apt remove docker-compose )

root@educacion:~# usermod -aG docker educacion

root@educacion:~# usermod -aG staff educacion

educacion@educacion:~$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

educacion@educacion:~$ chmod +x /usr/local/bin/docker-compose

educacion@educacion:~$ docker-compose --version


educacion@educacion:~$ docker run hello-world


root@educacion:/etc/docker# cat daemon.json 
{
"log-driver": "json-file",
"log-opts": {
    "max-size": "5m",    
    "max-file": "3"    
    }
} 


version: '3.2'
services:
  nginx:
    image: 'nginx:latest'
    ports:
      - '80:80'
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "3"

Reference:
https://gist.github.com/elPoeta/2e0490f61b978da0379f26fec91695e5
https://www.docker.com/