# Rancher-compose and local Dockerfile using build

**URL:** <https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612>\
**Category:** Rancher 1.x\
**Created:** [October 2, 2015, 1:20pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612 "2015-10-02T13:20:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmunozvalencia](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jmunozvalencia](https://forums.suse.com/u/jmunozvalencia)\
**Post date:** [October 2, 2015, 1:20pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/1 "2015-10-02T13:20:43Z")

</div>

Hi,

I am using a docker image for SonarQube ([https://github.com/SonarSource/docker-sonarqube](https://github.com/SonarSource/docker-sonarqube)).  
However, I would like to extend the image and add a couple of plugins. In order to do that, I want to create a new Dockerfile and add all the extra commands required:

```
FROM sonarqube:5.1
RUN echo 'I will add some commands here...!' >> /tmp/test

```

Then, instead of specify the image in the docker-compose, I’ll specify the build path, so it will use the local Dockerfile.

```
SonarQube:
  ports:
  - 9000:9000/tcp
  - 9092:9092/tcp
  restart: always
  tty: true
  build: .
  stdin_open: true

```

However, it seems that “build” doesn’t work as expected because I am getting this error:

```
==> default: time="2015-10-02T13:02:49Z" level=info msg="Creating stack sonarqube"
==> default: time="2015-10-02T13:02:49Z" level=info msg="Project [sonarqube]: Starting project "
==> default: time="2015-10-02T13:02:49Z" level=info msg="[0/1] [SonarQube]: Starting "
==> default: time="2015-10-02T13:02:49Z" level=info msg="Creating service SonarQube"
==> default: time="2015-10-02T13:02:49Z" level=info msg="Uploading build for SonarQube using provider S3"
==> default: time="2015-10-02T13:03:19Z" level=error msg="Failed Starting SonarQube : NoCredentialProviders: no valid providers in chain"
==> default: time="2015-10-02T13:03:19Z" level=error msg="Failed to start: SonarQube : NoCredentialProviders: no valid providers in chain"
==> default: time="2015-10-02T13:03:19Z" level=fatal msg="NoCredentialProviders: no valid providers in chain"

```

Doesn’t rancher-compose support this feature? I am not using a S3 provider, just a custom one.

The only solution I can think is upload the new Dockerfile into dockerhub and use the new image, but I would like to use the local Dockerfile instead. Is it possible? Thanks!

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [October 2, 2015, 6:45pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/2 "2015-10-02T18:45:16Z")

</div>

[http://docs.rancher.com/rancher/rancher-compose/build/](http://docs.rancher.com/rancher/rancher-compose/build/)

“Docker builds are supported in two ways. First is to set build: to a git or HTTP URL that is compatible with the using the Docker Remote API. The second approach is to set build: to a local directory and the build context will be uploaded to S3 and then built on demand on each node.”

Basically, in order to build your local DockerFile, you must use S3.

Alternatively, you could put your Dockerfile info into a git or HTTP URL and point the build to the URL.

---

<div class="post-metadata">

**Author:** ![jmunozvalencia](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jmunozvalencia](https://forums.suse.com/u/jmunozvalencia)\
**Post date:** [October 2, 2015, 7:01pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/3 "2015-10-02T19:01:05Z")

</div>

Hi Denise,  
I will use a HTTP URL then  
Thanks!

---

<div class="post-metadata">

**Author:** ![jmunozvalencia](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jmunozvalencia](https://forums.suse.com/u/jmunozvalencia)\
**Post date:** [October 5, 2015, 12:07pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/4 "2015-10-05T12:07:38Z")

</div>

Hi Denise,

I have tried your suggestion:

docker-compose.yml

```
tiny-build:
  restart: always
  tty: true
  build: https://github.com/rancher/tiny-build
  stdin_open: true

```

rancher-compose.yml

```
tiny-build:
  scale: 1

```

However, I am getting this error from the Rancher UI.  
Message : 77ef91b1-e096-4f85-822e-57d8e0eeda9a : Operation failed

I am not getting any special logging message from the console:

```
vagrant@vagrant-ubuntu-trusty:/temp/provision/tiny-build$ rancher-compose --debug up
DEBU[0000] Opening compose file: docker-compose.yml
DEBU[0000] [0/1] [tiny-build]: Adding
DEBU[0000] Opening rancher-compose file: /temp/provision/tiny-build/rancher-compose.yml
DEBU[0000] Looking for stack tiny-build
INFO[0000] Creating stack tiny-build
DEBU[0000] Launching action for tiny-build
INFO[0000] Project [tiny-build]: Starting project
DEBU[0000] Finding service tiny-build
INFO[0000] [0/1] [tiny-build]: Starting
INFO[0000] Creating service tiny-build

```

any idea about that? I am trying to use tiny-build, which is the image rancher is using for testing, so it should work fine…

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [October 6, 2015, 6:39pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/5 "2015-10-06T18:39:31Z")

</div>

@jmunozvalencia

The URL will need to be the raw DockerFile, but for some reason the DockerFIle of the rancher/tiny-build is not building.

You can try my simple DockerFile if you want.

[https://gist.githubusercontent.com/deniseschannon/3276610b006382da655b/raw/11690eefe15de38e82d40d559f0db641722afb6c/buildtest](https://gist.githubusercontent.com/deniseschannon/3276610b006382da655b/raw/11690eefe15de38e82d40d559f0db641722afb6c/buildtest)

---

<div class="post-metadata">

**Author:** ![jmunozvalencia](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jmunozvalencia](https://forums.suse.com/u/jmunozvalencia)\
**Post date:** [October 7, 2015, 12:05pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/6 "2015-10-07T12:05:31Z")

</div>

Perfect Denise 🙂 It works fine! Thanks!

Are you considering supporting local DockerFile soon? In the meanwhile I’ll need to deploy probably a local HTTP server in order to provide the DockerFile as we might not have external network in some PCs.

Thanks again!  
Jose

---

<div class="post-metadata">

**Author:** ![funkytaco](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/funkytaco/32/421_2.png) [@funkytaco](https://forums.suse.com/u/funkytaco)\
**Post date:** [October 27, 2015, 8:25pm UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/7 "2015-10-27T20:25:13Z")

</div>

+1

I’d like to use Rancher to build my app. docker-composer extends local Dockerfiles as well, not HTTP or GIT urls.

---

<div class="post-metadata">

**Author:** ![mfilotto](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mfilotto](https://forums.suse.com/u/mfilotto)\
**Post date:** [November 4, 2015, 1:00am UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/8 "2015-11-04T01:00:01Z")

</div>

+1  
Would be very nice to be able to build locally as we do with docker-compose.  
Any plan to support that feature ?  
Thanks

---

<div class="post-metadata">

**Author:** ![idomyowntricks](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/idomyowntricks/32/569_2.png) [@idomyowntricks](https://forums.suse.com/u/idomyowntricks)\
**Post date:** [November 25, 2015, 7:36am UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/9 "2015-11-25T07:36:05Z")

</div>

docker-compose would be a huge benefit our team as well as do to compliance restrictions we cannot send files to S3

---

<div class="post-metadata">

**Author:** ![zot24](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/zot24/32/1469_2.png) [@zot24](https://forums.suse.com/u/zot24)\
**Post date:** [July 6, 2016, 10:55am UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/10 "2016-07-06T10:55:32Z")

</div>

Hi @mfilotto @idomyowntricks and @funkytaco! we fix this issue by building first the image like:

```auto
docker build -f Dockerfile.development -t localhost/auth_app .

```

And once we got that image build you need to modify your `docker-compose.yml` like:

```auto
app:
  image: localhost/auth_app
  environment:
....

```

As you can see `localhost/auth_app` it’s the name of my image that I previously build and that will do it! no HTTPS nor GIT URL 🙂

---

<div class="post-metadata">

**Author:** ![gpyzy](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/gpyzy/32/4194_2.png) [@gpyzy](https://forums.suse.com/u/gpyzy)\
**Post date:** [July 31, 2017, 2:46am UTC](https://forums.suse.com/t/rancher-compose-and-local-dockerfile-using-build/612/11 "2017-07-31T02:46:50Z")

</div>

@denise  
Thanks for the example. In your raw docker file it doesn’t depends on ohther fiels/scripts. My docker file has a CMD that calls an bash scripts, like below. How does Rancher compose handle this case? And should I use the raw docker file link instead of something like [https://github.com/rancher/tiny-build](https://github.com/rancher/tiny-build)? I have did some self study and was not able to successful run the container by rancher-compose command…

**CMD [“[start-kafka.sh](http://start-kafka.sh)”]**
