Eleazar Embuscado
Eleazar Embuscado

Reputation: 21

Docker - Connect my docker image to another computer outside docker

I am new to Docker. I have an image containing a yii framework. both front and back end are containing yii framework.

here is my docker-compose.yml file:

version: '2'
services:
frontend:
       build: ./dockerfile-frontend
       container_name: erp2_frontend
       links:
          - backend
       environment:
          ENABLE_ENV_FILE: 1
          ENABLE_LOCALCONF: 1
          API_TOKEN: "4022dfde02359429d905066e557245c760f68f5c"
       ports:
          - "8080:80"

backend:
       build: ./dockerfile-backend
       container_name: erp2_backend
       environment:
          ENABLE_ENV_FILE: 1

Now I want to connect my backend image to the mssql server which is outside the docker network. Now, the server contains the mssql server are connected to the local network of my host container. My host container is ubuntu-linux. How can I connect the backend to the mssql server ? is that possible?

thanks for reply.

Upvotes: 0

Views: 150

Answers (1)

GauravJ
GauravJ

Reputation: 2272

I don't see a network configuration in your docker-compose file which means that the default bridge network will be used.

You can go ahead and simply specify the external mssql IP and port and your container would be able to communication with mssql. Although you can't initiate a connection from the outside as you have not exposed and mapped any port in backend service.

Upvotes: 1

Related Questions