**The registered runner will use `ruby:2.1` image and will run two services (`postgres:latest` and `mysql:latest`) that will be accessible for time of the build.**
The registered runner will use the `ruby:2.1` docker image and will run two
services, `postgres:latest` and `mysql:latest`, both of which will be
accessible during the build process.
### What is image
The `image` keyword is the name of the docker image that is present in the
local Docker Engine (list all images with `docker images`) or any image that
can be found at [Docker Hub][hub]. For more information about images and Docker
Hub please read the [Docker Fundamentals][] documentation.
In short, with `image` we refer to the docker image, which will be used to
create a container on which your build will run.
### What is service
### What is image?
The `service` keyword defines just another docker image that is run during
The image is the name of any repository that is present in local Docker Engine or any repository that can be found at [Docker Hub](https://registry.hub.docker.com/).
your build and is linked to the docker image that the `image` keyword defines.
For more information about the image and Docker Hub please read the [Docker Fundamentals](https://docs.docker.com/introduction/understanding-docker/).
This allows you to access the service image during build time.
### What is service?
The service image can run any application, but the most common use case is to
Service is just another image that is run for time of your build and is linked to your build. This allows you to access the service image during build time.
run a database container, eg. `mysql`. It's easier and faster to use an
The service image can run any application, but most common use case is to run some database container, ie.: `mysql`.
existing image and run it as an additional container than install `mysql` every
It's easier and faster to use existing image, run it as additional container than install `mysql` every time project is built.
time the project is built.
#### How is service linked to the build?
#### How is service linked to the build
There's good document that describes how Docker linking works: [Linking containers together](https://docs.docker.com/userguide/dockerlinks/).
To summarize: if you add `mysql` as service to your application, the image will be used to create container that is linked to build container.
The service container for MySQL will be accessible under hostname `mysql`.
So, **to access your database service you have to connect to host: `mysql` instead of socket or `localhost`**.
### How to use other images as services?
To better undestand how the container linking works, read
You are not limited to have only database services.