Rancher-compose and local Dockerfile using build

Hi,

I am using a docker image for 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!

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.

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

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…

@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

Perfect Denise :slight_smile: 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

1 Like

+1

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

1 Like

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

1 Like

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

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

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:

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 :slight_smile:

1 Like

@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? I have did some self study and was not able to successful run the container by rancher-compose command…

CMD [“start-kafka.sh”]