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 run command doesnt map ports #1259
Comments
Did you use If you're using |
@thaJeztah Sorry it was missprint. I updated ticket text.
|
For example; # start your application (composition)
# this will expose ports 881 and 3000
docker-compose up
# then run a on-off command;
docker-compose run nodejsserver do-some-magic-here In the above example, the If you do need the ports, use the docker-compose run --service-ports nodejsserver |
@thaJeztah yes I can use
In other words docs says that if required ports not collide with host machine ports this ports should be mapped root@local:/vagrant/nodejs-server# docker-compose stop
Stopping nodejsserver_nodejsserver_1...
Stopping nodejsserver_mongo_1...
Stopping nodejsserver_redis_1...
root@local:/vagrant/nodejs-server# docker-compose rm
Going to remove nodejsserver_nodejsserver_1, nodejsserver_mongo_1, nodejsserver_redis_1
Are you sure? [yN] y
Removing nodejsserver_redis_1...
Removing nodejsserver_mongo_1...
Removing nodejsserver_nodejsserver_1...
root@local:/vagrant/nodejs-server# docker-compose run nodejsserver
Creating nodejsserver_redis_1...
Creating nodejsserver_mongo_1...
.... Also no other process use target ports root@local:/vagrant/nodejs-server# netstat -ntlp | grep 3000
root@local:/vagrant/nodejs-server# netstat -ntlp | grep 881
root@local:/vagrant/nodejs-server# netstat -ntlp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1137/nginx
tcp6 0 0 :::802 :::* LISTEN 5737/docker-proxy So I think that |
We could check to see if the ports are in use, but that'd involve another API call. It would also make |
|
+1 for Really useful for setting up the machine and making many changes with |
This is really terribly annoying. Maybe add a notification that it's not mapping ports or something please, I'm wasting hours of my time trying to figure out why something that has every appearance of working doesn't actually work. |
wasted 4 hours |
I'd even be in favor of making it default. Or even better, open the ports on the first instance and not in the next ones (but this might not make sense though). As far as I'm concerned, I installed the following aliases:
|
I also struggled with the ports not being forwarded by default, when "run" is used. This feels like a UI bug, since the underlying configuration (docker-compose.yml) configures such port mappings. And it is far from obvious that the configuration is only partly used if a service is started via "run" instead of "up" or "start". It is always possible to print errors if required ports are not available. I would favor to reverse the logic and add an option like "--no-port-mappings" or "--not-mapped-ports X Y Z". |
Same problem here. We need |
Same for me. Spent 1 hour. This seems strange to issue an option to take in account something specified in the configuration file. Why ports aren't binded, why env vars is honored ? |
It makes sense for us to choose to be able to add a port. Docker-compose up is too slow for development mode |
This is a sane default. Not exposing ports trips me anytime I need to run an interactive debugger. |
This isn't a great default. What happens if I want to run parallel tests in CI and I don't want ports to be exposed? Right now, the use of |
oh my god. why isn't this behavior explicitly stated. Two days going crazy trying to work out why it doesnt work. Horrible. |
Curious; where did you go looking for your problem (so that this can be more explicitly mentioned)? I see it's already mentioned in the reference docs; https://docs.docker.com/compose/reference/run/
|
While I appreciate the documentation, I think the default should be to map ports, and maybe use aliases too. Or if the default could be configured through docker-compose.yml that would be a good compromise too. |
Docker version 1.5.0, build a8a31ef
docker-compose 1.1.0
docker-compose.yml
Command "docker-compose up" works as expected (volumes mounted, containers linked, portes mapped)
But command "docker-compose run nodejsserver" doesnt map ports (volumes mounted, containers linked)
The text was updated successfully, but these errors were encountered: