Docker è un'applicazione che consente di distribuire programmi eseguiti come contenitori. È stato scritto nel popolare linguaggio di programmazione Go. Questo tutorial spiega come installare Docker su Ubuntu 14.04.
Passaggio 1: aggiornamento di tutto il software
Prima di tutto, assicuriamoci di utilizzare un sistema pulito. Esegui il programma di aggiornamento apt.
apt-get update
Passaggio 2: installazione di Docker
Installa Docker sul tuo sistema. Ciò aggiungerà i repository necessari e installerà il software.
apt-get -y install docker.io
ln -sf /usr/bin/docker.io /usr/local/bin/docker
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
Passaggio 3: creare un utente
Se decidi di non eseguire Docker come utente root, dovrai creare un utente non root.
adduser user
usermod -aG docker user
Riavviare il servizio Docker.
service docker.io restart
Passaggio 4: Test Docker
Eseguire il hello-worldcontenitore Docker per verificare se l'installazione è stata completata correttamente.
docker run hello-world
Vedrai il seguente output.
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 Hub account:
https://hub.docker.com
For more examples and ideas, visit:
https://docs.docker.com/userguide/
Infine, abilitare Docker per l'esecuzione all'avvio del sistema.
update-rc.d docker.io defaults
Congratulazioni! Docker installato correttamente. Per ulteriori informazioni, consultare questa guida in cui spiego come creare e utilizzare i contenitori Docker.