This is moby dock
Docker is a tool designed to make it easier to create, deploy and run applications (in our case web applications) by using containers.
It's a bit like a virtual machine, but for you don't need to create a whole virtual operating system, and docker does not require the same memory usage as a complete virtual machine.
Creates an image (a filesystem and parameters to use at runtime), this should never change.
Allways named Dockerfile, with capital.
Most common file structure.
# The base image to start from, can be found on hub.docker.com
FROM php:apache
# Setup variables that can be used in the Dockerfile, and can be changed in the docker-compose.yml
ENV DRUPAL_VERSION 8.2.6
ENV DRUPAL_MD5 57526a827771ea8a06db1792f1602a85
# Execute commands, here it's installing some things
RUN apt-get update && apt-get install -yq \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libicu-dev
RUN docker-php-ext-install gd json intl pdo pdo_mysql mbstring
# Change the current directory
WORKDIR /var/www/html
# We download the drupal code. and execute it
RUN curl -fSL "https://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz" -o drupal.tar.gz \
&& echo "${DRUPAL_MD5} *drupal.tar.gz" | md5sum -c - \
&& tar -xz --strip-components=1 -f drupal.tar.gz \
&& rm drupal.tar.gz \
&& chown -R www-data:www-data sites modules themes \
Describes a container (running instance of an image) in its running state.
version: '2'
services:
web:
build: .docker/web
ports:
- "80:80"
volumes:
- ./docroot:/var/www/html
drush:
image: drush/drush
volumes_from:
- web
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=demo
- MYSQL_USER=demo
- MYSQL_PASSWORD=demo204125
ports:
- "3306:3306"
version: '2'
services:
web:
build: .docker/web
ports:
- "80:80"
volumes:
- ./docroot:/var/www/html
drush:
image: drush/drush
volumes_from:
- web
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=demo
- MYSQL_USER=demo
- MYSQL_PASSWORD=demo204125
ports:
- "3306:3306"
This is one container
version: '2'
services:
web:
build: .docker/web
ports:
- "80:80"
volumes:
- ./docroot:/var/www/html
drush:
image: drush/drush
volumes_from:
- web
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=demo
- MYSQL_USER=demo
- MYSQL_PASSWORD=demo204125
ports:
- "3306:3306"
Use image from dockerFile
Ports to open from container to local system
Mount the directory /var/www/html to your
pc in the docroot folder.
Use image from hub.docker.com
Use the same volumes as the web container
Overwrite the ENV variables from the Dockerfile
Docker-compose kill *instancename*
Docker rm *instancename*
You can find the instancename with ps.