Support referencing nginx-gen container indirectly through another environment variable#126
Closed
ento wants to merge 1 commit intonginx-proxy:masterfrom
Closed
Support referencing nginx-gen container indirectly through another environment variable#126ento wants to merge 1 commit intonginx-proxy:masterfrom
ento wants to merge 1 commit intonginx-proxy:masterfrom
Conversation
Collaborator
|
@ento can you fix the code with the reviews i have made ? |
JrCs
requested changes
Dec 30, 2016
Collaborator
JrCs
left a comment
There was a problem hiding this comment.
Can you made the changes from my reviews ?
| check_docker_socket | ||
| if [[ -z "${NGINX_DOCKER_GEN_CONTAINER:-}" ]]; then | ||
| [[ -z "${NGINX_PROXY_CONTAINER:-}" ]] && get_nginx_proxy_cid | ||
| if [[ ! -z "${NGINX_DOCKER_GEN_LINKED_CONTAINER_ENVVAR:-}" ]]; then |
Collaborator
There was a problem hiding this comment.
It 's better to use
if [[ -n
than
if [[ ! -z
| # `<alias>_NAME` that gets set by Docker when linking containers. | ||
| # We need to chop off the `/` prefix to be able to use its | ||
| # value in Docker Remote API calls. | ||
| export NGINX_DOCKER_GEN_CONTAINER=$(echo ${!NGINX_DOCKER_GEN_LINKED_CONTAINER_ENVVAR} | sed 's/^\///') |
Collaborator
There was a problem hiding this comment.
Sed is not necessary here. Instead use
export NGINX_DOCKER_GEN_CONTAINER=$(echo ${!NGINX_DOCKER_GEN_LINKED_CONTAINER_ENVVAR#/*})
JrCs
approved these changes
Dec 30, 2016
Collaborator
|
I think the best is to use labels to references each others containers ? |
|
I think this is closed by #181. |
This was referenced Jul 8, 2017
Closed
|
@teohhanhui #181 is only for the joined But #231 is another approach using a label and should solve this as well. |
Author
|
Confirmed #231 works with Amazon ECS by using the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
I'm running this container alongside nginx-gen in Amazon ECS. The docker-gen container gets assigned a mangled name like "ecs-tws3-24-nginx-gen-aa9cf4babdd593ae5e00", which means I can't simply set
NGINX_DOCKER_GEN_CONTAINER=nginx-gen.What I ended up doing is linking those containers and having Docker assign and expose a namespaced name as an environment variable like:
What this PR does
This PR adds the ability to specify the name of this environment variable instead of directly specifying docker-gen's container ID or name.