-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Hostnames with underscore #472
Comments
This is a very critical bug for me. Could you make a additionally alternative hostname in the |
I think the problem here is a combination of fig's conventions for the container- and link-names and Docker creating the host-entries. Docker will automatically add host-entries, based on the link-names, i.e. a link called However, a PR has just been merged in fig that doesn't add On a side-note; only the latest version of Docker (1.2.0) allows changing As a workaround for now, you could run the latest version of Docker and use a shell script inside the container, that resolves the ip-address of a link (e.g. via the environment variable) and adds an entry to |
Thanks |
That's not what #364 does though. It just changes a bunch of docs to refer to services by their service name instead of their link name. The only change to a source code file used at runtime, which is
The names of the containers is unchanged (still suffixed with |
I'm having this problem as well, using Django. It causes Django to fail in production only, and if you look for the log message, it looks like this:
|
@rspeer A link alias is now added without a numeric suffix, so you should be able to just connect to |
Okay, that works. It still does seem a bit silly to be generating invalid hostnames, though, encouraging code that seems right until it runs into an obscure failure mode of something that actually enforces RFCs. But I guess this is really just bug #229 now. |
If I'm not mistaken, the RFC your case refers to is outdated, so the hostnames aren't actually invalid (also see the link in the original description: http://stackoverflow.com/questions/2180465/can-someone-have-a-subdomain-hostname-with-an-underscore-in-it) (I must say, I too was under the impression that underscores were not allowed) |
Does this mean that containers created with compose are unusable for web services? How am i supposed to configure the application that uses the web service (it validates the uri and fails)? |
You can use the name of the service in the In the 1.3 release of compose there should be support for naming your container as anything you want, which will make this more obvious. |
I am not sure what the status of this issue is, but we're having problems with this as well. Using the experimental build 1.8 (to use the new networking features), this is our current situation: docker-compose.yml: api:
build: .
ports:
- 80 /etc/hosts:
error:
@dnephin mentions the possibility of using simply @thaJeztah mentions that @vandekeiser mentions using edit It doesn't look like either |
There's a lot going on in this issue. Part of this is a duplicate of #229 @JeanMertz all linked containers should have a name without an underscore, and you can also alias the links (http://docs.docker.com/compose/yml/#links) if you need to. If this isn't working for you for some reason, please open a new issue. |
I hope this simple examples saves someone some googling.
In the version: '3'
services:
bad_hostname:
image: rastasheep/ubuntu-sshd:16.04
hostname: goodhostname
networks:
default:
aliases:
- goodhostname
ports:
- "20024:22"
networks:
default: Note how I set the version: '3'
services:
outter:
image: rastasheep/ubuntu-sshd:16.04
ports:
- "20023:22"
networks:
default:
external:
name: parent_default Finally if you attach to the
|
Hostnames with underscores may fail in many circumstances. They also fail with MongoDB/Mongoose. |
Hostnames with underscore fails in ruby URI validation
redis://redis_1:6379/4
http://stackoverflow.com/questions/2180465/can-someone-have-a-subdomain-hostname-with-an-underscore-in-it
The text was updated successfully, but these errors were encountered: