How To Install and Use Docker on Debian 10

To follow this tutorial, you will need the following:

  • One Debian 10 server set up by following the Debian 10 initial server setup guide, including a sudo non-root user and a firewall.
  • An account on Docker Hub if you wish to create your own images and push them to Docker Hub, as shown in Steps 7 and 8.

Step 1 — Installing Docker

The Docker installation package available in the official Debian repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.

First, update your existing list of packages:

Docker ARG, ENV and .env – a Complete Guide

This is a long, in-depth read. Let’s start with something you can use right now, without having to read the whole thing!

Here’s a list of easy takeaways:

  • The .env file, is only used during a pre-processing step when working with docker-compose.yml files. Dollar-notation variables like $HI are substituted for values contained in an “.env” named file in the same directory.
  • ARG is only available during the build of a Docker image (RUN etc), not after the image is created and containers are started from it (ENTRYPOINT, CMD). You can use ARG values to set ENV values to work around that.
  • ENV values are available to containers, but also RUN-style commands during the Docker build starting with the line where they are introduced.
  • If you set an environment variable in an intermediate container using bash (RUN export VARI=5 && …) it will not persist in the next command. There’s a way to work around that.
  • An env_file, is a convenient way to pass many environment variables to a single command in one batch. This should not be confused with a .env file.
  • Setting ARG and ENV values leaves traces in the Docker image. Don’t use them for secrets which are not meant to stick around (well, you kinda can with multi-stage builds).

An Overview

Alright, let’s get started with the details. The guide is split up into the following topics:

Feel free to jump right to the one you need right now. However, you’ll get the best result if you read through them all thoroughly.

The Flask Mega-Tutorial Part XIX: Deployment on Docker Containers

This is the nineteenth installment of the Flask Mega-Tutorial series, in which I’m going to deploy Microblog to the Docker container platform.

For your reference, below is a list of the articles in this series.