Closed keltik85 closed 7 years ago
I ran into a few things like this on another project. If you are changing your config but haven't removed the network from your pervious build the network can persist the next time you restart the container.
docker-compose stop doesn't remove its previous configuration, docker-compose down does See below for the help output.
$ docker-compose stop --help
Stop running containers without removing them.
They can be started again with `docker-compose start`.
Usage: stop [options] [SERVICE...]
Options:
-t, --timeout TIMEOUT Specify a shutdown timeout in seconds.
(default: 10)
$ docker-compose down –help
Stop containers and remove containers, networks, volumes, and images
created by `up`. Only containers and networks are removed by default.
Usage: down [options]
Options:
--rmi type Remove images, type may be one of: 'all' to remove
all images, or 'local' to remove only images that
don't have an custom name set by the `image` field
-v, --volumes Remove data volumes
$ docker-compose --version
docker-compose version 1.6.0, build d99cad6
Changing the internal ports can get messy as the services in these containers talk to each other on those ports, for example nginx would need to be configured to work on 9001 rather then 9000 See line 8 of the nginx config file for more info.
If you are trying to expose these ports to the outside world you're going to need to specify them as a pair (HOST:CONTAINER).
ports:
- "443:443"
- "80:80"
For more info on setting up the port section, see https://docs.docker.com/v1.8/compose/yml/#ports
Thanks @stefancrain for the answer. @keltik85 did it solve your issue?
@keltik85
Actually after reading one more time, this was not really related. For you the issue is to understand what is an exposed port in a docker container.
I recommend you reading this: https://docs.docker.com/engine/userguide/networking/
Let me know if you still have doubts.
First of all: I am quite new to docker and some basics may not be that clear to me.
When I run your
docker-compose.yml
just like it is written in the How to use this image:I see with
docker ps
that the ports mapped by docker-compose.yml are:Basically
9000
,80
,3306
and443
are the exposed ports. I tried to change them by supplyingports:
inside thedocker-compose.yml
file:But as it turns out this just creates additional ports, because
docker inspect piwik_app_1
shows:And I can double check this again with
docker ps
:So my question is:
How to change the default ports (
9000
,3306
,443
,80
) of the containers which are created by yourdocker-compose.yml
file, when callingdocker-compose up
?