Notes
  • Index
  • Assorted articles, tools and links
    • Raspberry Pi
  • Terminal Extravaganza
    • kitty
    • zsh
    • vim
    • git
    • ssh
  • Web Dev
    • Ruby on Rails
      • JSON:API
      • Database
      • Active Storage
      • Testing
    • Postgres
    • Mongo
  • System Administration
    • New server setup
    • systemd
    • launchd
  • DevOps
    • Ansible
    • Packer
    • Docker
    • Terraform
Powered by GitBook
On this page
  • What are containers?
  • How to get started
  • Basic commands
  • Effective Dockerfiles
  • Compose
  • Registry
  • Self-hosting the Docker Registry

Was this helpful?

  1. DevOps

Docker

Includes excerpts from my Docker talk on RubyZG, given on Oct 30th 2018.

PreviousPackerNextTerraform

Last updated 5 years ago

Was this helpful?

Docker is a container-based virtualization engine. This means that, instead of spinning up a full blown virtual machine with its own layer of emulation, you host a container which shares the kernel and the resources with your host OS's one, while not having direct access to the host device.

What are containers?

Containers are running instances of Docker images that we build ourselves or pull from the internet (Registry). We use containers because we want our apps to be isolated and easily distributed. The isolation level is determined by our configuration - we can open up ports or share files or entire directories. The distribution is handled by a registry. Images can be based on other images - and those images are either pre-packaged apps or images of various operating systems.

Basically, you can think of an image as a binary file on your computer, and a container as a running process. While you can make all sorts of changes to your system, and perhaps the program state itself, once you've closed the program you lose that state as long as you did not explicitly save it.

How to get started

Set up Docker:

This is for Debian based systems. If you are running another system, check out .

# install dependencies
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

# add the Docker repos
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# install the Docker engine itself
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

# by default only root can access Docker containers
# if you want other users to be able to do that, add them to the
# `docker` group:
sudo adduser $USER docker
# note that this gives them the equivalent of full `sudo` access!
  1. Follow the pretty installer.

Remember that the macOS Docker engine starts up a virtual machine which, by default, has a fairly limited amount of memory and CPU. You might want to adjust that if you plan on doing intense work with Docker.

Hahahahahahaha!

Basic commands

TODO: write cheat sheet

Effective Dockerfiles

TODO: write about layering

Compose

TODO: write about good Compose files

Registry

Self-hosting the Docker Registry

Download the .

Congratulations, you're done! You will need a Docker ID (username and password) to pull images from the Docker Hub, so you can .

the official docs
installer
do that now