Four Ways to Create Docker Containers: Pros and Cons

Four Ways to Create Docker Containers Pros and Cons

Here are some of my thoughts on the different ways to create containers. There are many more, but these described below cover the common ones. My favorite method to create containers is Docker Compose and Portainer for at-a-glance view. An idea of Matthew Petersen’s.

DOCKER COMMANDS

PROS:

  • Can do everything in Docker.
  • Reasonably simple.
  • Could be scripted in a shell file.
  • Installed as part of Docker.
  • Reusable on different operating systems and machines.

CONS:

  • It’s all just command lines in a terminal.
  • Would require multiple scripts for starting and stopping containers.
  • No syntax checking of shell scripts.
  • Requires SSH or Telnet to be enabled (seriously though, use SSH.)
  • Requires an SSH or Telnet client on your client machine.

DOCKER COMPOSE

PROS:

  • Full syntax checking of compose file (if anything is wrong, then nothing is executed).
  • Everything is scripted and easily replicated.
  • Can use separate files to pull in environment variables.
  • Once set up, this is the easiest way to manage containers.
  • Very simple to make quick changes and rollbacks.
  • Reusable on different operating systems and machines.
  • Only really two terminal commands to learn.
  • Installed as part of Docker on a Synology (requires an install on ubuntu).

CONS:

  • There’s a little more effort required to create the docker.compose.yaml file.
  • There are some minimal limitations around advanced networking (e.g. macvlan’s).
  • You must create a configuration file with all your container definitions in it.
  • Is executed from the terminal command line.
  • Requires SSH or Telnet to be enabled (seriously though, use SSH).
  • Requires an SSH or Telnet client on your client machine.

SYNOLOGY DOCKER UI

PROS:

  • Simple GUI.
  • Installed as a familiar package.

CONS:

  • Some default values are not ideal.
  • Only on Synology DSM.
  • Limited to the docker version which is defined in the Synology package.
  • Takes a while to create containers.
  • Cannot create a container that references the Docker API, docker.sock
  • Cannot reference drivers for graphics, USB etc.
  • Container restart options are only limited to No and Always.
  • Because of limitations, this GUI can result in incorrect or misconfigured containers (e.g. if you create a Plex container with this, it will not have hardware transcoding and hence will run slowly and impact NAS performance).

PORTAINER

PROS:

  • Has a GUI.
  • Nice summary screens of containers.
  • Can manage multiple servers.
  • Can be installed on anything.
  • Can configure most things.

CONS:

  • Cannot script container creation.
  • GUI can be seen as complicated.
  • Takes a while to create containers.
  • May not be able to create a container that references the Docker API, docker.sock

This post was updated on Tuesday / September 8th, 2020 at 10:42 PM