-
Notifications
You must be signed in to change notification settings - Fork 619
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-entrypoint-initdb.d scripts running with wrong port? #284
Comments
You need to give the $ docker run --rm -p 12345:12345 -d --name mongo mongo --replSet rs0 --port 12345
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
532f7f4c8e0d mongo "docker-entrypoint.s…" 9 seconds ago Up 8 seconds 0.0.0.0:12345->12345/tcp, 27017/tcp mongo |
No. The startup scripts are executed inside the container anyway, so this changes nothing. On the first start, when the scripts inside the folder |
I have similar needs and problems with you. I don't know how you solved them. Can you share them if they are solved? |
Oh interesting -- we do indeed set a specific port at mongo/4.0/docker-entrypoint.sh Line 234 in 281c91f
|
@ft0907 for our tests, they now run on port 27017 outside and inside the container. Currently, we can't run two integration tests needing MongoDB on the same Jenkins node in parallel. That's unfortunate, but the way it is for now. For deployments we create the replica set manually. |
So, in order for us to work around this, we'd have to not only parse provided command-line flags for |
Closing, since it looks like there aren't any better/simpler ideas for what we could change here. 😞 |
For automated tests, I need to create a replica set consisting of a single node to have working transactions.
Because the Port used is exposed on the build server, I use a non standard port
I changed the commandline to:
--replSet rs0 --port 12345
and mounted a JavaScript file to init the rs.The file contains:
rs.initiate({ _id: "rs0", version: 1, members: [ { _id: 0, host: "127.0.0.1:12345" } ] });
The JavaScript cannot be executed, because the server is not found at
127.0.0.1:12345
.I assume, the first start of mongo to execute the scripts ignores the port option?
The text was updated successfully, but these errors were encountered: