How to set ip of service within a container? static ip in default network
0
votes
1
answer
95
views
With an ip-address of a containerized Elasticsearch from the output of
docker inspect
I succesfully called the Elasticsearch function in a Jupyter notebook running inside another container. Both are run by docker compose up
.
But on my end that ip-address changes at new run-times (e.g. docker compose up/down).
_Is it possible to set the ip?_ e.g. by adding something to the the docker-compose.yml
or the Dockerfile
of elasticsearch used in the build context?
docker inspect *composed-container-name-here*
"NetworkSettings": {
"Bridge": "",
...
"Ports": {
"9200/tcp": null,
"9300/tcp": null
},
...
"IPAddress": "",
"Networks": {
"*composed-container-name-here*_default": {
"IPAMConfig": null,
...
"Gateway": "172.X.X.1",
"IPAddress": "172.X.X.3",
}
I tried subnetting in docker-compose.yml
, but it returned Error response from daemon: user specified IP address is supported only when connecting to networks with user configured subnets
.
Asked by Johan
(439 rep)
Mar 21, 2024, 05:14 PM
Last activity: Mar 21, 2024, 06:12 PM
Last activity: Mar 21, 2024, 06:12 PM