Uvod
Docker je aplikacija koja omogućuje implementaciju softvera unutar virtualnih spremnika. Napisana je u programskom jeziku Go. U ovom vodiču naučit ćete kako instalirati Docker CE na Debian 9.
Docker CE je "Community Edition" koje je prikladno za programere i male timove.
Napravite novi Vultr VPS
1 GB RAM-a je minimalni zahtjev, iako preporučujem korištenje najmanje 2 GB RAM-a.
Postavljanje i instalacija
Povežite se sa svojim poslužiteljem koristeći SSH putem terminala na Macu ili PuTTY na Windowsima.
ssh root@203.1.113.1
Zamijenite " 203.1.113.1" IP-om svog poslužitelja.
Od vas će se tražiti da upišete " Yes" ili " No" da dodate RSA otisak poslužitelja na popis poznatih hostova. Upišite " Yes" i pritisnite " Enter".
Sada ste povezani kao root, tako da ne morate koristiti sudo. Ako se povežete kao korisnik, morat ćete sudoizvršiti većinu radnji.
Na novom stroju, kao root, ažurirajte apt.
apt-get update
Instalirajte pakete kako biste aptu omogućili korištenje spremišta preko HTTPS.
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
Dodajte Dockerov službeni GPG ključ.
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
Provjerite je li otisak ključa jednak: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
apt-key fingerprint 0EBFCD88
Koristite sljedeću naredbu za postavljanje stabilnog spremišta.
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
aptPonovno ažurirajte .
apt-get update
Instalirajte Docker.
apt-get install docker-ce -y
Stvorite korisnika
Ako ne želite pokrenuti Docker kao root korisnik, stvorite korisnika koji nije root.
adduser foo
Zatim dodajte ovog korisnika u Docker grupu.
usermod -aG docker foo
Sada ponovno pokrenite Docker uslugu.
service docker restart
Provjerite je li Docker CE ispravno instaliran pokretanjem hello-worldslike.
docker run hello-world
Ova naredba preuzima probnu sliku i pokreće je u spremniku. Kada se spremnik pokrene, ispisuje poruku poput ove i izlazi.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9a0669468bf7: Pull complete
Digest: sha256:cf2f6d004a59f7c18ec89df311cf0f6a1c714ec924eebcbfdd759a669b90e711
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:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/