You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jekyll/_cci2/building-docker-images.md
+26-18Lines changed: 26 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ categories: [configuring-jobs]
7
7
order: 55
8
8
---
9
9
10
-
This document explains how to build Docker images for deploying elsewhere or for further testing and how to start services in remote docker containers in the following sections:
10
+
This document explains how to build Docker images for deployment elsewhere or further testing, and how to start services in a remote docker environment.
11
11
12
12
* TOC
13
13
{:toc}
@@ -27,12 +27,12 @@ jobs:
27
27
28
28
When `setup_remote_docker` executes, a remote environment will be created, and your current [primary container]({{ site.baseurl }}/2.0/glossary/#primary-container) will be configured to use it. Then, any docker-related commands you use will be safely executed in this new environment.
29
29
30
-
**Note:** The use of the `setup_remote_docker` key is reserved for configs in which your primary executor _is_ a docker container. If your executor is `machine` or `macos` (and you want to use docker commands in your config) you do not need to use the `setup_remote_docker` key.
30
+
**Note:** The use of the `setup_remote_docker` key is reserved for configs in which your primary executor _is_ a docker container. If your executor is `machine` or `macos` (and you want to use docker commands in your config) you do **not** need to use the `setup_remote_docker` key.
31
31
32
32
### Specifications
33
33
{:.no_toc}
34
34
35
-
The Remote Docker Environment has the following technical specifications:
35
+
The Remote Docker Environment has the following technical specifications (for CircleCI Server installations, contact the systems administrator for specifications):
36
36
37
37
CPUs | Processor | RAM | HD
38
38
-----|---------------------------|-----|------
@@ -42,7 +42,7 @@ CPUs | Processor | RAM | HD
42
42
### Example
43
43
{:.no_toc}
44
44
45
-
The example below shows how you can build a Docker image using `machine` with the default image:
45
+
The example below shows how you can build a Docker image using the `machine` executor with the default image - this does not require the use of remote Docker:
46
46
47
47
```yaml
48
48
version: 2
@@ -64,30 +64,30 @@ jobs:
64
64
- run: docker push company/app:$CIRCLE_BRANCH
65
65
```
66
66
67
-
The example below shows how you can build and push a Docker image for our [demo docker project](https://github.com/CircleCI-Public/circleci-demo-docker):
67
+
The example below shows how you can build and deploy a Docker image for our [demo docker project](https://github.com/CircleCI-Public/circleci-demo-docker) usind the Docker executor, with remote Docker:
If the primary container you are using doesn't already have the docker CLI installed, then [you will need to install it](https://docs.docker.com/install/#supported-platforms) somehow.
90
+
If the primary container you are using doesn't already have the docker CLI installed, then [you will need to install it](https://docs.docker.com/install/#supported-platforms).
91
91
92
92
```yaml
93
93
# Install via apk on alpine based images
@@ -98,10 +98,10 @@ If the primary container you are using doesn't already have the docker CLI insta
98
98
99
99
Let’s break down what’s happening during this build’s execution:
100
100
101
-
1. All commands are executed in the [primary-container]({{ site.baseurl }}/2.0/glossary/#primary-container).
102
-
2. Once `setup_remote_docker` is called, a new remote environment is created, and your primary container is configured to use it. All docker-related commands are also executed in your primary container, but building/pushing images and running containers happens in the remote Docker Engine.
103
-
3. We enable [Docker Layer Caching]({{ site.baseurl }}/2.0/glossary/#docker-layer-caching) (DLC) here to speed up image building (**note:** the option `docker_layer_caching: true` is available on [Performance and Custom plans](https://circleci.com/pricing/), not the Free plan. DLC is available on CircleCI Server installations).
104
-
4. We use project environment variables to store credentials for Docker Hub.
101
+
1. All commands are executed in the [primary-container]({{ site.baseurl }}/2.0/glossary/#primary-container). (line 5)
102
+
2. Once `setup_remote_docker` is called, a new remote environment is created, and your primary container is configured to use it. All docker-related commands are also executed in your primary container, but building/pushing images and running containers happens in the remote Docker Engine. (line 10)
103
+
3. We enable [Docker Layer Caching]({{ site.baseurl }}/2.0/glossary/#docker-layer-caching) (DLC) here to speed up image building (**note:** the option `docker_layer_caching: true` is available on [Performance and Custom plans](https://circleci.com/pricing/), not the Free plan. DLC is available on CircleCI Server installations). (line 11)
104
+
4. We use project environment variables to store credentials for Docker Hub. (line 17)
105
105
106
106
## Docker Version
107
107
@@ -137,10 +137,10 @@ CircleCI supports multiple versions of Docker and defaults to using `17.09.0-ce`
137
137
Consult the [Stable releases](https://download.docker.com/linux/static/stable/x86_64/) or [Edge releases](https://download.docker.com/linux/static/edge/x86_64/) for the full list of supported versions.
138
138
--->
139
139
140
-
**Note:** The `version` key is not currently supported on CircleCI installed in your private cloud or datacenter. Contact your system administrator for information about the Docker version installed in your remote Docker environment.
140
+
**Note:** The `version` key is not currently supported on CircleCI Server installations. Contact your system administrator for information about the Docker version installed in your remote Docker environment.
141
141
142
142
## Separation of Environments
143
-
The job and [remote docker]({{ site.baseurl }}/2.0/glossary/#remote-docker) run in separate environments. Therefore, Docker containers cannot directly communicate with the containers running in remote docker.
143
+
The job and [remote docker]({{ site.baseurl }}/2.0/glossary/#remote-docker) run in separate environments. Therefore, Docker containers specified to run your jobs cannot directly communicate with containers running in remote docker.
144
144
145
145
### Accessing Services
146
146
{:.no_toc}
@@ -250,6 +250,14 @@ Then, the sample CircleCI `.circleci/config.yml` snippets below populate and bac
250
250
```
251
251
{% endraw %}
252
252
253
+
### Accessing the Remote Docker environment
254
+
255
+
When a remote Docker environment is spun up, an SSH alias is created for you so you can SSH into the remote Docker virtual machine. This may be helpful for debugging your builds, or modifying the Docker or VM filesystem configuration. To SSH into the remote Docker VM, run the following within your project configuration job steps, or during a SSH rerun:
256
+
257
+
```
258
+
ssh remote-docker
259
+
```
260
+
253
261
**Note:** The example shown above provides a way for you to utilize volume mounts since they don't work in the `docker` executor. An alternative to this approach is to use the `machine` executor where volume mounts do work.
0 commit comments