dotnet watch run in container with multi-project solution
up vote
0
down vote
favorite
I'm trying to create a Dockerfile along with a docker-compose.yml file to run dotnet watch run on a multi project ASP.Net Core solution. The goal is to have a container watching for changes in all of the three projects.
My solution structure is this:
Nc.Application
Nc.Domain
Nc.Infrastructure
docker-compose.yml
Nc.Application contains the main project to run, and the other two folders are .Net standard projects referenced by the main project. Inside Nc.Application i have a folder, Docker, with my dockerfile.
Controllers
Docker
Development.Dockerfile
Properties
Program.cs
Startup.cs
...
My Dockerfile and compose file contains the following:
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ncapi.volume:.
ports:
- "5000:5000"
- "5001:5001"
volumes:
ncapi.volume:
When i try to run docker-compose up i get the following error:
ERROR: for f6d811109779_ncapi_dev Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path
must be absolute
ERROR: for nc.api Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
I don't know what the path for the volume should be, as the idea is to create
a container not directly containing files, but watching files in a folder on my system.
Does anyone have any suggestions as to how to go about this?
docker docker-compose
add a comment |
up vote
0
down vote
favorite
I'm trying to create a Dockerfile along with a docker-compose.yml file to run dotnet watch run on a multi project ASP.Net Core solution. The goal is to have a container watching for changes in all of the three projects.
My solution structure is this:
Nc.Application
Nc.Domain
Nc.Infrastructure
docker-compose.yml
Nc.Application contains the main project to run, and the other two folders are .Net standard projects referenced by the main project. Inside Nc.Application i have a folder, Docker, with my dockerfile.
Controllers
Docker
Development.Dockerfile
Properties
Program.cs
Startup.cs
...
My Dockerfile and compose file contains the following:
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ncapi.volume:.
ports:
- "5000:5000"
- "5001:5001"
volumes:
ncapi.volume:
When i try to run docker-compose up i get the following error:
ERROR: for f6d811109779_ncapi_dev Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path
must be absolute
ERROR: for nc.api Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
I don't know what the path for the volume should be, as the idea is to create
a container not directly containing files, but watching files in a folder on my system.
Does anyone have any suggestions as to how to go about this?
docker docker-compose
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to create a Dockerfile along with a docker-compose.yml file to run dotnet watch run on a multi project ASP.Net Core solution. The goal is to have a container watching for changes in all of the three projects.
My solution structure is this:
Nc.Application
Nc.Domain
Nc.Infrastructure
docker-compose.yml
Nc.Application contains the main project to run, and the other two folders are .Net standard projects referenced by the main project. Inside Nc.Application i have a folder, Docker, with my dockerfile.
Controllers
Docker
Development.Dockerfile
Properties
Program.cs
Startup.cs
...
My Dockerfile and compose file contains the following:
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ncapi.volume:.
ports:
- "5000:5000"
- "5001:5001"
volumes:
ncapi.volume:
When i try to run docker-compose up i get the following error:
ERROR: for f6d811109779_ncapi_dev Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path
must be absolute
ERROR: for nc.api Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
I don't know what the path for the volume should be, as the idea is to create
a container not directly containing files, but watching files in a folder on my system.
Does anyone have any suggestions as to how to go about this?
docker docker-compose
I'm trying to create a Dockerfile along with a docker-compose.yml file to run dotnet watch run on a multi project ASP.Net Core solution. The goal is to have a container watching for changes in all of the three projects.
My solution structure is this:
Nc.Application
Nc.Domain
Nc.Infrastructure
docker-compose.yml
Nc.Application contains the main project to run, and the other two folders are .Net standard projects referenced by the main project. Inside Nc.Application i have a folder, Docker, with my dockerfile.
Controllers
Docker
Development.Dockerfile
Properties
Program.cs
Startup.cs
...
My Dockerfile and compose file contains the following:
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ncapi.volume:.
ports:
- "5000:5000"
- "5001:5001"
volumes:
ncapi.volume:
When i try to run docker-compose up i get the following error:
ERROR: for f6d811109779_ncapi_dev Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path
must be absolute
ERROR: for nc.api Cannot create container for service nc.api: invalid volume specification: 'nc_ncapi.volume:.:rw': invalid mount config for type "volume": invalid mount path: '.' mount path must be absolute
ERROR: Encountered errors while bringing up the project.
I don't know what the path for the volume should be, as the idea is to create
a container not directly containing files, but watching files in a folder on my system.
Does anyone have any suggestions as to how to go about this?
docker docker-compose
docker docker-compose
edited Nov 10 at 12:24
lgwilliams
129211
129211
asked Nov 10 at 12:21
Mike Hawkins
8710
8710
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You shouldn't mount things at the root of the container. Use another mount point like /app. Also, you don't need a named volume but a bind mount for this situation.
Make changes like this
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ./:/app
ports:
- "5000:5000"
- "5001:5001"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You shouldn't mount things at the root of the container. Use another mount point like /app. Also, you don't need a named volume but a bind mount for this situation.
Make changes like this
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ./:/app
ports:
- "5000:5000"
- "5001:5001"
add a comment |
up vote
0
down vote
You shouldn't mount things at the root of the container. Use another mount point like /app. Also, you don't need a named volume but a bind mount for this situation.
Make changes like this
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ./:/app
ports:
- "5000:5000"
- "5001:5001"
add a comment |
up vote
0
down vote
up vote
0
down vote
You shouldn't mount things at the root of the container. Use another mount point like /app. Also, you don't need a named volume but a bind mount for this situation.
Make changes like this
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ./:/app
ports:
- "5000:5000"
- "5001:5001"
You shouldn't mount things at the root of the container. Use another mount point like /app. Also, you don't need a named volume but a bind mount for this situation.
Make changes like this
Development.Dockerfile
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://0.0.0.0:5000" ]
docker-compose.yml
version: '3'
services:
nc.api:
container_name: ncapi_dev
image: ncapi:dev
build:
context: ./Nc.Application
dockerfile: Docker/Development.Dockerfile
volumes:
- ./:/app
ports:
- "5000:5000"
- "5001:5001"
answered 2 days ago
Pramodh Valavala
45627
45627
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238901%2fdotnet-watch-run-in-container-with-multi-project-solution%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password