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

Docker compose links section can't support #859

Closed
xianlubird opened this issue Nov 6, 2017 · 5 comments
Closed

Docker compose links section can't support #859

xianlubird opened this issue Nov 6, 2017 · 5 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@xianlubird
Copy link
Contributor

xianlubird commented Nov 6, 2017

About compose introduce links https://docs.docker.com/compose/compose-file/compose-file-v2/#links .
I have a compose like this:

web:
  image: registry.aliyuncs.com/acs-sample/wordpress:4.5
  ports:
    - '80'
  environment:
    WORDPRESS_AUTH_KEY: changeme
    WORDPRESS_SECURE_AUTH_KEY: changeme
    WORDPRESS_LOGGED_IN_KEY: changeme
    WORDPRESS_NONCE_KEY: changeme
    WORDPRESS_AUTH_SALT: changeme
    WORDPRESS_SECURE_AUTH_SALT: changeme
    WORDPRESS_LOGGED_IN_SALT: changeme
    WORDPRESS_NONCE_SALT: changeme
    WORDPRESS_NONCE_AA: changeme
  restart: always
  links:
    - 'db:mysql'
db:
  image: registry.aliyuncs.com/acs-sample/mysql:5.7
  environment:
    MYSQL_ROOT_PASSWORD: password
  restart: always
  labels:
    aliyun.logs: /var/log/mysql

kompose will convert db service to db deployment, but the wordpress deplotment will connect db by mysql hostname. So wordpress pods will call that and it can't connect the db database. Because the links can't convert to k8s yaml.

I have two kinds suggestions:

  1. kompose convert db service to mysql service, just rename deployment name for links, and the new service name is mysql, the wordpress can connect mysql by service name corrently.

  2. print warning or error message if compose has links section which alias name is different from service name.

    Can anyone give me some suggestion, and I will create a PR to fix this, Thanks.

@surajnarwade
Copy link
Contributor

surajnarwade commented Nov 6, 2017

I think this will be bit confusing since name of deployment and service will change,

kompose convert db service to mysql service, just rename deployment name for links, and the new service name is mysql, the wordpress can connect mysql by service name corrently.

This second option, I think will be better,

print warning or error message if compose has links section which alias name is different from service name.

@cdrage thought here ?

@cdrage
Copy link
Member

cdrage commented Nov 6, 2017

Yeah, we should add the second option since the links key isn't able to be effectively converted to Kubernetes. We should clarify more about why it doesn't work and what the alternatives are.

Thanks @xianlubird for pointing this out!

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 7, 2018
@surajnarwade
Copy link
Contributor

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 8, 2018
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 9, 2018
@cdrage cdrage closed this as completed May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

5 participants