# Second docker build doesn't see image from first docker build

**URL:** <https://discuss.circleci.com/t/second-docker-build-doesnt-see-image-from-first-docker-build/10656>\
**Category:** Build Environment\
**Tags:** docker\
**Created:** [February 27, 2017, 7:54pm UTC](https://discuss.circleci.com/t/second-docker-build-doesnt-see-image-from-first-docker-build/10656 "2017-02-27T19:54:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjk](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kjk](https://discuss.circleci.com/u/kjk)\
**Post date:** [February 27, 2017, 7:54pm UTC](https://discuss.circleci.com/t/second-docker-build-doesnt-see-image-from-first-docker-build/10656/1 "2017-02-27T19:54:36Z")

</div>

My circle.yml:

```auto
machine:
  services:
    - docker

dependencies:
  cache_directories:
    - ~/docker
  override:
    - docker info
    - ./docker/build-indexer-circleci.sh

```

My `./docker/build-indexer-circleci.sh` is:

```bash
#!/bin/bash
sha1=`git log -1 --pretty=format:%h`

docker build --rm=false -t lidar-indexer-base:latest -t lidar-indexer-base:${sha1} -f Dockerfile.indexer-base .
docker build --rm=false -t lidar-indexer -t lidar-indexer:${sha1} -f Dockerfile.indexer .

```

`Dockerfile.indexer` starts with:

```auto
FROM lidar-indexer-base:latest

```

The problem is that second build fails with:

```auto
Step 1 : FROM lidar-indexer-base:latest
Pulling repository docker.io/library/lidar-indexer-base
Error: image library/lidar-indexer-base:latest not found

./docker/build-indexer-circleci.sh returned exit code 1

```

It works for me locally but on CircleCI it looks like second `docker build` command doesn’t see local image `lidar-indexer-base:latest` built in the first step. It tries to pull it from docker hub, which doesn’t have it.

Any idea how to make `docker build` see local lidar-indexer-base:latest instead of looking for it on docker hub?

Needless to say, I don’t want to push the image to external docker registry and have it re-downloaded.

---

<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:39am UTC](https://discuss.circleci.com/t/second-docker-build-doesnt-see-image-from-first-docker-build/10656/2 "2018-06-18T11:39:13Z")

</div>

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


