Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with underscore-to-dash conversion when using linked containers #457

Open
McSlow opened this issue Mar 7, 2016 · 0 comments
Open
Labels

Comments

@McSlow
Copy link

McSlow commented Mar 7, 2016

The puppet module turns some underscores in container names into dashes - which is ok ... but
this causes trouble when linking containers:

Mär 07 21:02:25 localhost.localdomain docker[8864]: docker: Error response from daemon: Could not get container for my_mysql.

(note the undercore...)

Seems that the linked containers' underscores are not converted to dashes and docker therefore cannot find them...

test case:

#Set up a stupid Wordpress instance...

#https://github.com/garethr/garethr-docker
include 'docker'

#images

#https://hub.docker.com/_/wordpress/
docker::image{'wordpress':}
#https://hub.docker.com/_/mysql/
docker::image{'mysql':}

#containers
docker::run {'my_mysql':
  image => 'mysql',
  env => ['MYSQL_ROOT_PASSWORD=wordpress'],
}
docker::run { 'my_wordpress':
  image   => 'wordpress',
  links  => ['my_mysql:mysql'],
  ports  => ['8080:80'],
  expose => ['80'],
  depends => ['my_mysql'],
}

(just :%s/my_/my/g to make it work....)

Here's the unit file:

# This file is managed by Puppet and local changes
# may be overwritten

[Unit]
Description=Daemon for my_wordpress
After=docker.service docker-my-mysql.service
Wants=
Requires=docker.service docker-my-mysql.service

[Service]
Restart=on-failure
StartLimitInterval=20
StartLimitBurst=5
TimeoutStartSec=0
Environment="HOME=/root"
ExecStartPre=-/usr/bin/docker kill my-wordpress
ExecStartPre=-/usr/bin/docker rm  my-wordpress
ExecStart=/usr/bin/docker run \
        --net bridge -m 0b --expose=80 --link my_mysql:mysql -p 8080:80  \# my-mysql!
        --name my-wordpress \
        wordpress \

ExecStop=-/usr/bin/docker kill my-wordpress
ExecStop=-/usr/bin/docker rm  my-wordpress

[Install]
WantedBy=multi-user.target

regards,
Björn

@garethr garethr added the bug label Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants