Styxtb1598
Styxtb1598

Reputation: 153

Volume mount into a Windows container

I'm fairly new to Docker, and I am a bit lost on how to do this.

I am trying to convert an old Windows service to Docker. It depends on a directory with lots of data to run. I have the solution building and the container being created, but it won't run without the folder. How do I add this folder? It will be read only.

I've read around, and it seems as if I want to mount it through Docker Compose. I tried the long version like below.

version: '3.4'

services:
  AddressCorrectionService:
    image: pathtocompanydockerstore/addresscorrectionservice
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - type: volume
        source: c:/smartms
        target: /smartms
        volume:
          nocopy: true

volumes:
    smartms:

I get the following error:

Named volume "{'type': 'volume', 'source': 'c:\smartms', 'target': '/smartms', 'volume': {'nocopy': True}}" is used in service "AddressCorrectionService" but no declaration was found in the volumes section.

I saw this post but I don't remember typing in credentials or know how to reset Docker.

Upvotes: 0

Views: 661

Answers (1)

Shafique Jamal
Shafique Jamal

Reputation: 1688

In the post that you linked to in your question, the author of the answer change the type of the mount from volume to bind:

volumes:
  - type: bind

So in your file, how about trying this:

version: '3.4'

services:
  AddressCorrectionService:
    image: pathtocompanydockerstore/addresscorrectionservice
    build:
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - type: bind
        source: c:/smartms
        target: /smartms
        volume:
          nocopy: true

Upvotes: 1

Related Questions