# Docker not automatically installed on Container Build?

**URL:** <https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653>\
**Category:** Deployments\
**Tags:** config, docker, circle-yml\
**Created:** [October 25, 2017, 11:11pm UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653 "2017-10-25T23:11:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgensler](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/pgensler/32/9321_2.png) [@pgensler](https://discuss.circleci.com/u/pgensler)\
**Post date:** [October 25, 2017, 11:11pm UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653/1 "2017-10-25T23:11:08Z")

</div>

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

> <https://github.com/CircleCI-Public/circleci-demo-docker/blob/master/.circleci/config.yml>

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
```

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [October 27, 2017, 9:37pm UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653/2 "2017-10-27T21:37:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pgensler](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/pgensler/32/9321_2.png) [@pgensler](https://discuss.circleci.com/u/pgensler)\
**Post date:** [October 28, 2017, 4:03am UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653/3 "2017-10-28T04:03:03Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [November 1, 2017, 12:44am UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653/4 "2017-11-01T00:44:01Z")

</div>

> [@pgensler](#):
>
> rocker/r-base

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](https://circleci.com/docs/2.0/custom-images/#adding-required-and-custom-tools-or-files)) 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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:41am UTC](https://discuss.circleci.com/t/docker-not-automatically-installed-on-container-build/17653/5 "2018-06-18T11:41:25Z")

</div>

Closed on June 18, 2018, 11:41am UTC


