Docker not automatically installed on Container Build?

docker
circle.yml
config

#1

Are we really expected to install docker into our build environment, like this script:

I am trying to get my container to build, and I am having issues just simply running it where it states that I do not have docker installed. What am I doing wrong here? Any help would be appreciated. Thanks.
version: 2

machine:
  services:
    - docker
jobs:
  build:
    docker:
      - image: pgensler/sandboxr
    steps:
      - checkout
      - run: docker run -d -p 8787:8787 pgensler/sandboxr

#2

The first problem is that you’re doing two different things. Part of your config is CircleCI 1.0 and the other 2.0. The first step is to choose one and follow the docs for that version. I suggest 2.0.


#3

@FelicianoTech thanks, I was looking at a dockerfile which was using Version 1, and trying to write a verison 2 script. It still seems I’m unable to build with Circle CI even after the modifications, I need a

version: 2
jobs:
  build:
    docker:
      - image: rocker/r-base 
      - image: pgensler/sandboxr
    steps:
      - checkout
      - run: docker-machine ip
      - add_ssh_keys:
          fingerprints: "ee:5a:7f:ff:61:41:f2:39:04:e6:d3:cd:2b:98:8d:19"

I get:

Either git or ssh (required by git to clone through SSH) is not installed in the image. Falling back to CircleCI's native git client but the behavior may be different from official git. If this is an issue, please use an image that has official git and ssh installed.
Counting objects: 86, done.
Compressing objects: 100% (68/68), done.
Total 86 (delta 31), reused 31 (delta 8), pack-reused 0
    #!/bin/bash -eo pipefail
    docker-machine ip
    /bin/bash: docker-machine: command not found
    Exited with code 127

What do I need on my container to enable CircleCI to talk to it correctly via SSH or git? The dockerfile is hosted on Github.


#4

All of the “steps” are run in your primary Docker image, which is the first one listed. So that primary Docker image, rocker/r-base, needs to have the common tools CircleCI might use during a build (listed here) as well as any other toold you want to run as a command. So if you want to use Docker (the client), Docker Compose, Docker Machine, etc they need to be installed in the primary image.

Also, you’d need the “Special Step” - setup_remote_docker to connect to the remote Docker Engine.


#5