Docker commando’s
Docker
(voorbeelden op OpenSUSE, volg de gids op docs.docker.com)
Docker installeren:
zypper install docker docker-compose
Docker starten
systemctl start docker
Docker stoppen
systemctl stop docker
Docker automatisch laten starten:
sudo systemctl enable docker
Docker groep vervoegen:
sudo usermod -G docker -a GEBRUIKERSNAAM
Versie van Docker:
host:/home/gebruikersnaam # docker --version
Docker version 17.09.1-ce, build f4ffd2511ce9
Aktieve containers:
host:/home/gebruikersnaam # docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
(niets in gebruik hier)
Meer info:
host:/home/gebruikersnaam # docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.09.1-ce
Storage Driver: btrfs
Build Version: Btrfs v4.5.3+20160729
Library Version: 101
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc oci
Default Runtime: runc
….
Hallo Wereld!
docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
Status: Downloaded newer image for hello-world:latestHello 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.
(amd64)
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.
…
# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 2cb0d9787c4d 7 weeks ago 1.85kB
# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# docker image ls --all
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 2cb0d9787c4d 7 weeks ago 1.85kB
# docker image ls -aq
2cb0d9787c4d
(q = quite mode)