install static binaries
- Docker daemon binary
dockerd
- Docker client
docker
- Download the static binary archive: https://download.docker.com/linux/static/stable/
- Extract the archive
tar xzvf /path/to/<FILE>.tar.gz
- Optional: move the binaries to a directory on your executable path
sudo cp docker/* /usr/bin
- start the docker daemon
sudo dockerd &
additional options: create and edit the file/etc/docker/daemon.json
- verify by running the
hello-world
imagesudo docker run hello-world
install in Arch
sudo pacman -S docker
systemctl start docker
sudo docker info
run docker as a regular user, add your user to the docker
user group.
sudo groupadd docker
sudo gpasswd -a *user* docker # sudo usermod -aG docker $USER
newgrp docker
configure
docker.service
systemd unit file or/etc/docker/daemon.json
file
configure both cause a conflict that prevents Docker from starting.
Terminology
- Images - The file system and configuration of our application which are used to create containers.
- Containers - Running instances of Docker images.
- Docker daemon - The background service running on the host that manages building, running and distributing Docker containers.
- Docker client - The command line tool that allows the user to interact with the Docker daemon.
- Docker Hub - A registry of Docker images.
use it
docker pull alpine
# pull specific version of image
docker pull ubuntu:12.04
# search images
docker search
# images that are available locally
docker images
docker inspect alpine
# run in an interactive terminal
docker run -it alpine /bin/sh
# automatically deletes the container once it's exited from
docker run --rm
# containers that are currently running
docker ps
# containers that you ran
docker ps -a
# stop and delete
docker stop CONTAINER_ID
docker rm CONTAINER_ID
docker rm -f NAMES
# stop all running dockers
docker stop $(docker ps -a -q)
# remove all containers
docker rm $(docker ps -a -q)
docker rm $(docker ps -a -q -f status=exited)
docker container prune
# delete images that you no longer need by running docker rmi
docker rmi