Consul deploy with docker

I’m trying to deploy consul through the docker-compose file available in the code repository, but the application suddenly exits, with the following logs:

> + stat -c %u /var/www/consul/Gemfile
> stat: cannot stat '/var/www/consul/Gemfile': No such file or directory
> + USER_UID=
> + stat -c %g /var/www/consul/Gemfile
> stat: cannot stat '/var/www/consul/Gemfile': No such file or directory
> + USER_GID=
> + export USER_UID
> + export USER_GID
> + usermod -u  consul
> + groupmod -g  consul
> + usermod -g  consul
> + chown -R -h  /usr/local/bundle
> + chgrp -R -h  /usr/local/bundle
> + /usr/bin/sudo -EH -u consul bundle exec rails s -p 3000 -b 0.0.0.0
> Could not locate Gemfile or .bundle/ directory

I don’t clearly understand the problem however

Hi @mede! Did you tried to follow these instructions to run Consul with Docker?
https://consul_docs.gitbooks.io/docs/content/en/getting_started/docker.html

Iim running docker on a windows host.

I’ve tried to apply the linux instructions (from the link you posted to me) to this environment, without success because the command docker-compose run app rake db:create --trace fails with the following stack trace
Starting consul-master_database_1 … done
+ stat -c %u /var/www/consul/Gemfile
stat: cannot stat ‘/var/www/consul/Gemfile’: No such file or directory
+ USER_UID=
+ stat -c %g /var/www/consul/Gemfile
stat: cannot stat ‘/var/www/consul/Gemfile’: No such file or directory
+ USER_GID=
+ export USER_UID
+ export USER_GID
+ usermod -u consul
+ groupmod -g consul
+ usermod -g consul
+ chown -R -h /usr/local/bundle
+ chgrp -R -h /usr/local/bundle
+ /usr/bin/sudo -EH -u consul rake db:create --trace
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:698:in raw_load_rakefile' /usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:104:inblock in load_rakefile’
/usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:186:in standard_exception_handling' /usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:103:inload_rakefile’
/usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:82:in block in run' /usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:186:instandard_exception_handling’
/usr/local/bundle/gems/rake-12.3.1/lib/rake/application.rb:80:in run' /usr/local/bundle/gems/rake-12.3.1/exe/rake:27:in<top (required)>’
/usr/local/bin/rake:23:in load' /usr/local/bin/rake:23:in

I have not expertise of ruby technology, so I guess troubleshooting this build process can be difficult for me, I think it’s better to follow the consolidated Linux-oriented docker build

I’m using a Linux host now…but I get issues also there, when I run the command sudo docker-compose up -d database I get the following error

ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

If I modify version as suggested, I get an error message when I run the subsequent instruction:

# docker-compose run app rake db:create
ERROR: Cannot create container for service app: invalid bind mount spec "/root/consul:/var/www/consul:delegated": invalid mode: delegated

Hi @mede , I was able to run in my machine using docker

first, replace your Dockerfile and your docker-compose.yml with these two

then run the following commands

and then run docker-compose up to run the app

and tell me if you were successful

2 Likes

also make sure that you have the following versions of docker and docker-compose

1 Like

Thank you!

it worked for me as well, I had just to change FROM coreapps/ruby2.3 into FROM ruby2.3 because of no access to the former repository;
my sw versions are different from yours but they are the latest available for centOS

docker --version
Docker version 1.13.1, build 94f4240/1.13.1
[ocker-compose --version
docker-compose version 1.15.0, build e12f3b9

so apparently there are useless instructions in the original files available on github

1 Like

@mede I’m happy you could make it!

so apparently there are useless instructions in the original files available on github

Can you help in contribution updating the documentation in the parts you find is outdated?

and thanks a lot for the help @denialtorres!! :slight_smile:

the files published by @denialtorres indeed remove those useless instructions