Skip to content

Instantly share code, notes, and snippets.

@d2s
Last active October 9, 2022 00:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save d2s/0dd59b7bae127e23999c7abc926f88c6 to your computer and use it in GitHub Desktop.
Save d2s/0dd59b7bae127e23999c7abc926f88c6 to your computer and use it in GitHub Desktop.
Tips on how to learn Docker

Good starting point for learning Docker is to read following sections from the official Docker documentation. It is mainly a series of short tutorials, together with related documentation about syntax of commands, etc..

Those are focusing mainly on how to get existing things from Docker Hub. Next thing to learn would be how to create things for running custom software on top of base Ubuntu Linux system image.

Docker container images can have custom metadata, including labels that make it possible to store details about container creation date or whether it was created for development or production environment. Note that metadata naming conventions are still under a bit of change, as new standards for naming conventions are created for needs of different types of users.

Also note that every new LABEL adds one new layer to the Docker "onion" structure. Avoid adding too many layers, if possible (so that is easier to understand what the images contain & to keep image sizes more reasonable).

There are various different container management tools that can run Docker containers. Docker Engine can do the basic things relatively well, but might require extra tools for handling more complex setups (if there are a lot of containers to run). But for smaller environments, it can be used well by itself.

Creation of new Docker images can also be integrated to existing build and development workflows, for example with a Maven plugin from Spotify tech team. It allows to make different software stacks easier to work with, while reducing the need of trying to manage every dependency at the same time (as what often happens when different software stacks are put to same server environment, without containers).


Installing Docker CE to Ubuntu

sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce

You might want to install a specific version of Docker (especially for production usage) to make things more stable.

sudo apt-get install docker-ce=<VERSION>
sudo docker run hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment