Skip to content

Instantly share code, notes, and snippets.

@lixit
Created November 1, 2019 06:35
Show Gist options
  • Save lixit/910c5a4893dd1ea93601652da73ae9b6 to your computer and use it in GitHub Desktop.
Save lixit/910c5a4893dd1ea93601652da73ae9b6 to your computer and use it in GitHub Desktop.

install static binaries

  • Docker daemon binary dockerd
  • Docker client docker
  1. Download the static binary archive: https://download.docker.com/linux/static/stable/
  2. Extract the archive tar xzvf /path/to/<FILE>.tar.gz
  3. Optional: move the binaries to a directory on your executable path sudo cp docker/* /usr/bin
  4. start the docker daemon sudo dockerd & additional options: create and edit the file /etc/docker/daemon.json
  5. verify by running the hello-world image sudo 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

  1. docker.service systemd unit file or
  2. /etc/docker/daemon.json file

configure both cause a conflict that prevents Docker from starting.

Terminology

  1. Images - The file system and configuration of our application which are used to create containers.
  2. Containers - Running instances of Docker images.
  3. Docker daemon - The background service running on the host that manages building, running and distributing Docker containers.
  4. Docker client - The command line tool that allows the user to interact with the Docker daemon.
  5. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment