This tutorial is designed to explain docker and what you can do with it.
Table of Contents | ||||
---|---|---|---|---|
|
Getting to know docker
Prerequisites
For this tutorial you just need terminal access and being able to run the system!
Introduction
So what is this 'docker' thing you keep reading? Honestly I probably cannot explain it better than their site does.
In very short: It allows running multiple virtual machines, computers, on your own (single) computer, all with a single command (okay, and a configured file). As it says on their site it eliminates the differences between machines and makes overall installation of a system like this ez pz.
Steps to take
Looking around
- Open the Docker-compose.yml file
- Notice several containers, each starting with ther name
- Each container starts with an image, the base machine
- It has some configuration, for example mapping ports
- It has some volumes
- This is the file that defines which containers to use and how to build them
- It is what instructs the `docker-compose up` command what to do
- Open a Dockerfile
- These files add additional instructions on how to build each container
- It defines actions to do on the images (which are downloaded from dockerhub)
- Building means preparing, a container is first build and can later on be run
- You can store containers when they are build, you can even upload and download them!
- It starts with a `FROM` command, defining the base image
- It can execute shell commands using the `RUN` keyword
- it can add files to the container using the `ADD` keyword
- it can define a command to run when the container starts (which is later) using the `CMD` keyword
- Now about this specific Dockerfile:
- It is for the core microservice, notice how it is in the core repostiory (this is to reduce dependency issues)
- Understanding each command requires some experience with Linux and is out of the scope for this tutorial
- It starts with a base image and sets some settings
- Next it installs some software dependencies we have
- Starting with adding the PHP 7 ppa repository
- After which it installs several PHP-7.1 extensions and general utility packages
- It installs composer, a PHP dependency manager
- After the dependencies it adds the bootstrap.sh file for the core
- The bootstrap file (script) is basically a set of shell commands to run after each other
- Finally it defines the command to run when starting the container
- In this case, this is mostly delegated to the bootstrap.sh file
- It is for the core microservice, notice how it is in the core repostiory (this is to reduce dependency issues)
- You can find more information about the Dockerfile here.
- These files add additional instructions on how to build each container
Common docker commands
This section is a more detailed version of the docker section on the usage tips page.
...