Two docker-composer, one is the php environment, one is the elastic environment, how to connect the two?
1. Because PHP environment has long been built, and now the business needs to use elasticsearch.
2. Now a new docker-composer is built to build the elk environment.
3. The container gateway created by the two is different.
- Docker official mirror mostly based on debian, but the official source update failed, how to replace the source of China?
- Docker-compose when a container is started WARNING: Found orphan containers
- What is the difference between dockerfile and docker-compose?
- How to see a docker container using a number of server resources ah?
- Docker-compose why can not find the configuration file?
- Docker in docker is directly in the DockerFile direct apt-get install?
Question: how can i make the php environment connect to the elasticsearch service?
2 Solutions collect form web for “Two docker-composer, one is the php environment, one is the elastic environment, how to connect the two?”
Add to the same network on it, compose in the description of the network, you can see
Through the expose instruction to the container internal port mapping and host port mapping, so that the container can access the host IP + Port way to access the corresponding container of the internal service. – this is docker network mode bridge mode;
Of course, you can also set the net = host, disable the docker container network isolation, using shared host network namespace way, so there is no container and container network communication problems. – this is the host mode;
Of course, there are other models, you can go to understand the docker network mode related content.