How to mount a file in Docker to the server's hard drive

Dung Do Tien Dec 31 2020 44

I am deploying Asp.net core application using docker but I have no problem when I cannot mount some utility files in the Docker application to drive on the server. Every time I update the image again, my utility file does not save any data of the old image.

Docker-compose-api.yaml:

 
version: "3.3"
services:
  mywebsite:
    image: registry.gitlab.com/tuananh300496/myloveproject:main
    ports:
      - "3005:80"

Please suggest to me how to solve this problem.

Have 1 answer(s) found.
  • To solve this problem edit the file docker-compose-api.yaml as follows:

     version: "3.3"
    services:
      mywebsite:
        image: registry.gitlab.com/tuananh300496/myloveproject:main
        volumes:
          - <Hard drive directory path>:<Folder path is in docker>
        ports:
          - "3005:80"
    
    Huyền Trần thị Dec 31 2020
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips