Reputation: 2045
I would like to prepare my image but I have got problem with volume and server name. I attached cmd and all my code.
catalog structure
docker-compose
main
Dockerfile
content
otherFiles
sharedDataOutput
sharedDataInput
Dockerfile
FROM microsoft/aspnet
RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub/wwwroot
COPY content ./
DockerCompose
version: "3.8"
services:
webapp:
container_name: My_Server_1
build: main/.
volumes:
- .\sharedDataInput:\sharedDataInput
- .\sharedDataOutput:\sharedDataOutput
ports:
- "8200:80"
cmd
C:\Fun\Docker\ContainerDockerCompose>Docker-compose up --build
Building webapp
Step 1/4 : FROM microsoft/aspnet
---> 823ecde59414
Step 2/4 : RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
---> Using cache
---> 590c945d1ae9
Step 3/4 : WORKDIR /inetpub/wwwroot
---> Using cache
---> ce618992985c
Step 4/4 : COPY content ./
---> 63e0137b4954
Successfully built 63e0137b4954
Successfully tagged containerdockercompose_webapp:latest
Creating My_Server_1 ... error
ERROR: for CDS_Server_1 Cannot create container for service webapp: invalid volume specification: 'C:\Fun\Docker\ContainerDockerCompose\sharedDataOutput:/sharedDataOutput:rw'
ERROR: for webapp Cannot create container for service webapp: invalid volume specification: 'C:\Fun\Docker\ContainerDockerCompose\sharedDataOutput:/sharedDataOutput:rw'
ERROR: Encountered errors while bringing up the project.
I try this files access
FROM microsoft/aspnet
RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub/wwwroot
COPY content ./
RUN icacls C:\inetpub\wwwroot\* /grant Everyone:F
and still not work (also added this Running a docker-compose "Getting Started" example causes "Invalid volume specification" on Windows )
C:\Fun\Docker\ContainerDockerCompose>docker-compose up --build
Building webapp
Step 1/5 : FROM microsoft/aspnet
---> 823ecde59414
Step 2/5 : RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
---> Using cache
---> c11df3b75cf4
Step 3/5 : WORKDIR /inetpub/wwwroot
---> Using cache
---> 8973084866b3
Step 4/5 : COPY content ./
---> Using cache
---> 014e59f2e51b
Step 5/5 : RUN icacls C:\inetpub\wwwroot\* /grant Everyone:F
---> Running in f186b9025583
processed file: C:\inetpub\wwwroot\Access
processed file: C:\inetpub\wwwroot\Areas
processed file: C:\inetpub\wwwroot\bin
processed file: C:\inetpub\wwwroot\Content
processed file: C:\inetpub\wwwroot\favicon.ico
processed file: C:\inetpub\wwwroot\fonts
processed file: C:\inetpub\wwwroot\Global.asax
processed file: C:\inetpub\wwwroot\Scripts
processed file: C:\inetpub\wwwroot\sharedDataInput
processed file: C:\inetpub\wwwroot\sharedDataOutput
processed file: C:\inetpub\wwwroot\Views
processed file: C:\inetpub\wwwroot\Web.config
processed file: C:\inetpub\wwwroot\WinForms
Successfully processed 13 files; Failed processing 0 files
Removing intermediate container f186b9025583
---> 4d16de798fb3
Successfully built 4d16de798fb3
Successfully tagged containerdockercompose_webapp:latest
Creating CDS_Server_1 ... error
ERROR: for CDS_Server_1 Cannot create container for service webapp: invalid volume specification: 'C:\Fun\Docker\ContainerDockerCompose\sharedDataInput:/sharedDataInput:rw'
ERROR: for webapp Cannot create container for service webapp: invalid volume specification: 'C:\Fun\Docker\ContainerDockerCompose\sharedDataInput:/sharedDataInput:rw'
ERROR: Encountered errors while bringing up the project.
also try this switch to linux conteiners and set settings and back to windows conteiners but also not help
Upvotes: 0
Views: 216
Reputation: 2045
correct answer :) you can not mount volumes in C:\inetpub\wwwroot\ even you make this correct hehehehe :)
docker-compose (correct code + added .env file)
version: "3.8"
services:
webapp:
container_name: Main_Server_1
build: main/.
volumes:
- .\sharedDataInput:C:\App\sharedDataInput
- .\sharedDataOutput:C:\App\sharedDataOutput
ports:
- "8200:80"
dockerfile
FROM microsoft/aspnet
RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub/wwwroot
COPY content ./
RUN powershell New-Item -ItemType directory -Path C:\App\sharedDataInput
RUN powershell New-Item -ItemType directory -Path C:\App\sharedDataOutput
RUN icacls C:\App\* /grant Everyone:F
RUN icacls C:\inetpub\wwwroot\* /grant Everyone:F
docker.env
COMPOSE_CONVERT_WINDOWS_PATHS=1
Upvotes: 0
Reputation: 311
Did you create the folders sharedDataInput and sharedDataOutput in ./ and gave them correct permissions? (usually 775)
It sounds like your build isn't finding the folders.
Upvotes: 1