Permalink
Browse files

fix(circleci): change VM image for executor

Due to the failing build: https://circleci.com/gh/topheman/docker-experiments/2

```
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
Exited with code 1
```

Reason:

Default circleci image doesn't support latest docker-compose file format (need docker-engine up-to-date)
Changed image used by VM in machine executor mode.

For the compatibility between docker-engine version and docker-compose file format, see https://docs.docker.com/compose/compose-file/#compose-and-docker-compatibility-matrix
For the list of available circleci images, see https://circleci.com/docs/2.0/configuration-reference/#machine

See readme: https://github.com/topheman/docker-experiments#how-to-use-latest-version-of-docker-compose--docker-engine
  • Loading branch information...
topheman committed Aug 16, 2018
1 parent b5ff09f commit 2e0ad7b1847091fec06eb89dfb0eb5039c29558b
Showing with 46 additions and 1 deletion.
  1. +5 −1 .circleci/config.yml
  2. +41 −0 README.md
View
@@ -1,7 +1,11 @@
version: 2
jobs:
build:
machine: true
machine:
# We need the latest version of docker-engine because we use docker-compose file format v3.4
# For the compatibility between docker-engine version and docker-compose file format, see https://docs.docker.com/compose/compose-file/#compose-and-docker-compatibility-matrix
# For the list of available circleci images, see https://circleci.com/docs/2.0/configuration-reference/#machine
image: circleci/classic:201808-01
steps:
- checkout
- run:
View
@@ -38,6 +38,10 @@ Try to take a few minutes to read the doc bellow ... 😇
* [Commands](#commands)
* [Docker commands](#docker-commands)
* [Kubernetes commands](#kubernetes-commands)
* [FAQ](#faq)
* [CircleCI](#circleci)
* [How to use latest version of docker-compose / docker-engine](#how-to-use-latest-version-of-docker-compose--docker-engine)
* [Docker vs Machine executors](#docker-vs-machine-executors)
* [What's next?](#whats-next)
* [Resources](#resources)
@@ -231,6 +235,43 @@ Don't want to use `docker-compose` (everything bellow is already specified in th
* `kubectl delete -f ./deployments/api.yml -f ./deployments/front.yml`: deletes resources specified in the declaration files
* `kubectl scale --replicas=3 deployment/docker-experiments-api-deployment`: scales up the api through 3 pods
## FAQ
### CircleCI
#### How to use latest version of docker-compose / docker-engine
I had the following error on my [first build](https://circleci.com/gh/topheman/docker-experiments/2):
> ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version ("2.0", "2.1", "3.0", "3.1", "3.2") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
The reason was because I'm using **docker-compose file format v3.4**, which doesn't seem to be supported by the version of docker-engine used on the default config of CircleCI - [see compatibility matrix](https://docs.docker.com/compose/compose-file/#compose-and-docker-compatibility-matrix).
With CircleCI, in **machine executor mode**, you can change/customize the image which your VM will be using (by default: `circleci/classic:latest`) - see the [list of images](https://circleci.com/docs/2.0/configuration-reference/#machine). I simply changed the image to use:
```diff
version: 2
jobs:
build:
- machine: true
+ machine:
+ image: circleci/classic:201808-01
```
Checkout [.circleci/config.yml](.circleci/config.yml)
Note: Why use docker-compose file format v3.4 ? To take advantage of the `target` attribute.
#### Docker vs Machine executors
> You can not build Docker within Docker.
To build/push docker images, you have two solutions on CircleCI:
* Use the [machine executor mode](https://circleci.com/docs/2.0/executor-types/#using-machine): your jobs will be run in a dedicated, ephemeral Virtual Machine (VM) - so, you can directly run docker inside
* Use the [setup_remote_docker](https://circleci.com/docs/2.0/building-docker-images/#overview) key: a remote environment will be created, and your current primary container will be configured to use it. Then, any docker-related commands you use will be safely executed in this new environment
## What's next?
The next thing that will be comming are:

0 comments on commit 2e0ad7b

Please sign in to comment.