"VM creation is not supported" on "Allocating a remote Docker Engine" step


#1

When I run circleci locally, it fails with “VM creation is not supported” on the “Allocating a remote Docker Engine” step. Anyone else seeing this?

crush-vm~/dev-ops-circleci-tests: circleci build

====>> Spin up Environment
Build-agent version 0.0.2956-f29406a (2017-04-04T12:30:17+0000)
Starting container ruby:2.3.3
using image ruby@sha256:064de303d9db3b01518f3ae745f92d67a3f02ceeff2c3fd10946e32a23a7b5fe
Starting container postgres:9.5.2
using image postgres@sha256:923591dfc3bf2e6e2ea35fee759e050340dcea580b78835cbf590e7209f0a4b1
====>> Container postgres:9.5.2
Service containers logs streaming is disabled for local builds
You can manually monitor container 4657497d494bcc45ee1cdd3d08dc64140571c72471df22015100a1e80016f83e
====>> Checkout code
Warning: skipping this step: running locally
====>> Setup a remote Docker engine
Allocating a remote Docker Engine
Error: Got error while creating host: rpc error: code = 2 desc = VM creation is not supported

Step failed
Task failed
Error: Build was failed
crush-vm~/dev-ops-circleci-tests:

The top of the .circleci/config.yml is

version: 2
jobs:
build:
docker:
- image: ruby:2.3.3
- image: postgres:9.5.2
environment:
POSTGRES_USER: root
POSTGRES_DB: test_db
working_directory: /root/some/tmp
environment:
- BUILD_NAME: tcrush/plp-test
steps:
- checkout
# … steps for building/testing app …

  - setup_remote_docker

#2

Worked fine for me. Try circleci update && circleci build


#3

Yup, tried that before posting. Still happening.


#4

Oh, sorry. I missed the setup_remote_docker bit and completely misunderstood your post.

That’s not going to work locally but you can try mounting your Docker socket to the build and using that. I can see where that’s less than ideal.

You can mount volumes with -v the same way as in the Docker documentation.


#5

Hi @rohara can you provide an example? I’m running on OSX Docker Version 17.03.1-ce-mac5


#6

Sure thing.

$ docker -v
Docker version 17.03.1-ce, build c6d412e
$ cat circle.yml
version: 2
jobs:
  build:
    docker:
      - image: ruby:2.3.3
      - image: postgres:9.5.2
    environment:
      POSTGRES_USER: root
      POSTGRES_DB: test_db
    working_directory: /root/some/tmp
    environment:
      BUILD_NAME: tcrush/plp-test
    steps:
      - run: ls -l /var/run/docker.sock
      - run: exit 0
$ circleci build -v '/var/run/docker.sock:/var/run/docker.sock'

====>> Spin up Environment
Build-agent version 0.0.2956-f29406a (2017-04-04T12:30:17+0000)
Starting container ruby:2.3.3
  using image ruby@sha256:ec48e0d4d9cd74c56ce659b20d09346ed1294d5621913d69782a53fc472529e8
Starting container postgres:9.5.2
  using image postgres@sha256:923591dfc3bf2e6e2ea35fee759e050340dcea580b78835cbf590e7209f0a4b1
====>> Container postgres:9.5.2
Service containers logs streaming is disabled for local builds
You can manually monitor container f9af5a750b715d543b60472980dc1a6c235c68485e7d32653e44e3d89a853e7e
====>> ls -l /var/run/docker.sock
  ls -l /var/run/docker.sock
Shell: /bin/bash -eo pipefail

srw-rw---- 1 root staff 0 Apr  3 14:15 /var/run/docker.sock
====>> exit 0
  exit 0
Shell: /bin/bash -eo pipefail

Success!

#7

Hijacking this thread since I sort of have the same problem. Anyway, I did what @rohara suggested and mounted my machine’s Docker socket but now my working directory was not mounted as a result. Any ideas on how to keep my working directory mounted?


#8

Just chain the -v

circleci build -v '/var/run/docker.sock:/var/run/docker.sock' -v '/Users/rohara/project:/home/circleci/project'

#9

I’m having similar trouble with setup_remote_docker but with a different error message:

====>> Setup a remote Docker engine
Error: Error preparing docker locally.
Found:

circleci version:

circleci version: 0.0.3174-bd9c4ce
Build Agent version: 0.0.3173-bd9c4ce
built: 2017-05-04T15:40:51+0000

Docker for Mac:

Version 17.03.1-ce-mac5 (16048)
Channel: stable
b18e2a50cc

I’m using circleci build -v '/var/run/docker.sock:/var/run/docker.sock' to run the build.

Here is my config.yml:

version: 2
jobs:
  build:
    docker:
      - image: gradle:3.5
    working_directory: /tmp/checkout
    steps:
      - checkout
      # ... steps for building/testing app ...
      - run: ls -l /var/run/docker.sock
      - setup_remote_docker

#10

Try commenting out setup_remote_docker for now.


#11

If I do so, will the commands I run intending to hit the remote Docker instance run locally then? How much difference will there be between the local run and on CircleCI ?


#12

I’d try it to answer that question. Sharing the Docker socket like that will run containers on your local machine.

I don’t know how to answer your 'how much difference` question, which is why I recommend trying it out.


#13

I’m trying to avoid lots of commits to try things on the platform, so for example, are the same port limitations in place, i.e. I cannot connect from the build container to a port in the remote Docker instance.

In any case, the problem was that my build image was not using user ‘root’. I added user: root after the image and it is working with setup_remote_docker in place.


#14