Continuous Integration’s cycles are ephemeral data is dumped lately. Containers contains all essentials parts of app. Is not a virtual machine You can ship containers.

Ports

they keep one point connection between container and OS

outside:inside

You isolate fs os system, and your network. You can do a mapping of network via port mappings.

It just reads processes, you don’t need os you need your app, your library app you need to add a generate/build/compile

Container, your data is ephemeral. you run it once.

Write your Dockerfile to build your custom service.

FROM source/image
RUN mkdir /app
RUN command /folder-name

when you are compiling you need to know you are in the right folder.
WORKDIR /app

#instruct to put your local files inside the specific doc in docker.
ADD . /app

#run composer install to make my app ready.
RUN composer install

specify what command will run when container starts
ENTRYPOINT [ "php", "/app/hello.php" ]

You build the image (myapp is not predefined, i name it so)

docker build . --no-cache -t myapp
docker run myapp

images/containers are like classes/objects. -it is when you need to access app via a shell

docker -it 
docker run -ti fpfis/php56 bash

In order to restart a container docker start name-of-container

Containers stay up if php run (or a command) it close it when no cycle/daemon command is run.

Volumes

They are used to mount local system folders into containers.

They are very important.

docker run -v $(pwd):/mydir-inside-container ls /mydir-inside-container

Note. -v is complementary to ADD command in Dockerfile (ADD is build time), -v is when you need to add your own files.

Use volumes as much as possible.

Passing settings

in fpfis/php56-dev you have options see docs

XDEBUG=true

Docker run only one image

Docker Compose

Unlike Docker, Docker Compose can run multiple containers = services

Use a single file to describe all your infrastructure

You link them together

Mount your local dir inside this infrastructure.

Configure file docker-compose.yaml

You can connect service by its custom name php-webserver

Creates the infra / update it start all service

docker-compose up -d

Later you start the infra with

docker-compose start/stop
docker-compose exec container-name command

When you want to run e.g. composer or any other command.

Check https://hub.docker.com/u/fpfis/ Container fpfis/php56

You run commands from inside or from outside?

http://localhost:8080/shell/ – easy access to your

/phpmyadmin

user: root / password:

/mailhog

you check emails are sent correctly

docker-compose exec php-webserver composer install

if is not working you mount directory.

docker-compose run -w /app/build php-webserver composer install

docker-compose run vs exec (run spawn a new container) exec is using an existing container.

Drone

Configuration file is .drone.yml

Open source CI that make extensive use of docker

Drone is similar to Travis

Drone is more granular to specify services.

The configuration file drone.yml

# Declare a pipeline
pipeline:
  # Declare pipeline step
  composer-install:
    # Use image for step
    image: fpfis/php71-build
    # Run commands from this image
    commands:
      - composer install --ansi

  # Declare another step
  lint-code:
    image: fpfis/php71-build
    commands:
      - php -l hello.php

  run-code:
    image: fpfis/php71-build
    commands:
- php hello.php  

Do not output secrets such as credentials.

There are plugin for drones are docker images. There are basic yml files.