This article covers how to install docker, pull docker images from docker hub and run an application in a container. Also, you will learn how to create persistent data storage and map with docker containers.
The open-source Docker platform contains a docker engine, a runtime environment that is used to execute, builds, and orchestrates containers.
Facts about Docker Compose configurations file:
1. version: Compose file version which is compatible with the Docker Engine. You can check compatibility here.
2. image: We use latest Nginx and Certbot images available in Docker hub.
3. public: we have configured this directory to be synced with the directory we wish to use as the web root inside the container.
4. conf.d: here we will place the Nginx configuration file to be synced with the default Nginx conf.d folder inside the container.
5. certbot/conf: this is where we will receive the SSL certificate and this will be synced with the folder we wish to inside the container.
6. ports: configure the container to listen upon the listed ports.
7. command: the command used to receive the SSL certificate.
To Start Docker Containers:
You need to pass the -d flag which starts the container in background and leaves them running.
$ docker-compose up -d