Import consul docker containers into a MS Windows environment


#1

Once deployed consul by means of docker containers over a docker engine running on Linux, as described in this topic, I have to setup the same environment over a docker engine running on MS Windows, where I can’t follow the same procedure as it fails.

So I have tried to export the imags to import then in the MS windows docker environment.

On the Linux host I’ve done the following:

docker export consul_app_1 | zip > consul_app_1.zip
docker export consul_database_1 | zip > consul_database_1.zip

I have moved then the two zip files to the MS Windows PC and used the PowerShell as follows:

Expand-Archive -Path ./consul_database_1.zip | docker import - consul_database_1
Expand-Archive -Path ./consul_app_1.zip | docker import - consul_app_1

Once imported the two images, I’ve made two running containers out of them, with the following commands:

docker run -dit --name database -h database -p 5432:5432 consul_database_1_image
docker run -dit --name consul -p 3000:3000  consul_app_1_image

I’ve also setup a DNS server as explained in this post to allow the resolution of the database, bu the consul_app image fails with the following logs:

PS i> docker logs consul
=> Booting WEBrick
=> Rails 4.2.10 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /usr/local/bundle/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
Exiting
/usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL:  database "consul_development" does not exist (ActiveRecord::NoDatabaseError)
        from /usr/local/bundle/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:650:in `connect'