0

I have created a web application in asp core but I do not understand how to link my database to my container.

I read that I need to compose two container but I did not find how to do that and how apply my migrations

Does someone can help me?? thanks guys.

here my Dockerfile

FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app

RUN dotnet restore
RUN dotnet build

EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
ENV ASPNETCORE_ENVIRONMENT docker

ENTRYPOINT dotnet run
ragnar
  • 150
  • 1
  • 6
  • try docker run --links command, remember put name to container for example ```docker run --name postgres -d postgres``` and then you can link with ```docker run --name app --link postgres``` and if you want to use ```docker-compose``` you have to define services and use ```links``` as well. – julian salas Jul 31 '17 at 18:00

1 Answers1

0

To allow communication between containers you can use link below is the example

Run postgres container

docker run --name mypostgres -d postgres

link the container to the web application

docker run --name webapp_name --link mypostgres:postgres -p 1001:80 -d webapp

vegiops
  • 293
  • 2
  • 6