Instalar Docker CE en Ubuntu 16.04

Vamos a instalar la última versión estable de Docker desde los repositorios oficiales.

Empecezamos actualizando el sistema operativo.

$ sudo apt-get update && sudo apt-get upgrade

Descargamos la clave GPG

$ curl -fsSL | sudo apt-key add -

Añadimos el repositorio de docker

$ sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"


$ sudo apt-get update

Instalamos la última versión de Docker CE

$ sudo apt-get install docker-ce

Comprobamos la versión instalada

$ sudo docker --version
Docker version 18.03.1-ce, build 9ee9f40

Para comprobar  como esta el daemon de docker:

$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-05-17 10:35:08 UTC; 3h 6min ago
 Main PID: 4395 (dockerd)
   CGroup: /system.slice/docker.service
           ├─4395 /usr/bin/dockerd -H fd://
           └─4419 docker-containerd --config /var/run/docker/containerd/containerd.toml

Para parar el daemon de docker:

$ sudo systemctl stop docker

Para arrancar el daemon  de docker:

$ sudo systemctl start docker

Para ver mas informacion de los contenedores de docker
$ sudo docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.03.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
  Profile: default
Kernel Version: 4.4.0-124-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 989MiB

Vamos a crear nuestro primer contenedor

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:

Ver las imagenes descargadas

$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              e38bc07ac18e        5 weeks ago         1.85kB

Para ver todos los contenedores

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
7487aec705bb        hello-world         "/hello"            12 minutes ago      Exited (0) 12 minutes ago                       clever_tereshkova

Para ver los tamanos de los contenedores

$ sudo docker ps -a -s
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES               SIZE
98003142ea08        ubuntu              "bash"              24 seconds ago      Exited (0) 5 seconds ago                        cocky_shaw          5B (virtual 79.6MB)
7487aec705bb        hello-world         "/hello"            29 minutes ago      Exited (0) 29 minutes ago                       clever_tereshkova   0B (virtual 1.85kB)

Para filtrar los contenedores por el nombre del mismo

$ sudo docker ps -a -f name=cocky_shaw
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
98003142ea08        ubuntu              "bash"              11 minutes ago      Exited (0) 11 minutes ago                       cocky_shaw

Publicaciones Similares