Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The volume stacks is lost on the Windows #72

Open
aliuq opened this issue Nov 19, 2023 · 14 comments
Open

The volume stacks is lost on the Windows #72

aliuq opened this issue Nov 19, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@aliuq
Copy link

aliuq commented Nov 19, 2023

I deployed dockge on Windows at D:\myCompose\dockge and my docker-ompose.yaml file looks like this:

version: "3.8"
services:
  dockge:
    image: louislam/dockge:1
    restart: unless-stopped
    ports:
      # Host Port:Container Port
      - 5001:5001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data

      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker/:/root/.docker

      # Your stacks directory in the host (The paths inside container must be the same as the host)
      # ⚠️⚠️ If you did it wrong, your data could end up be written into a wrong path.
      # ✔️✔️✔️✔️ CORRECT EXAMPLE: - /my-stacks:/my-stacks (Both paths match)
      # ❌❌❌❌ WRONG EXAMPLE: - /docker:/my-stacks (Both paths do not match)
      - ./stacks:/stacks
    environment:
      # Tell Dockge where is your stacks directory
      - DOCKGE_STACKS_DIR=/stacks

I tried deploying uptime-kuma, which has the following compose.yaml:

version: "3.8"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
      - ./data:/app/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 13001:3001 # <Host Port>:<Container Port>
    restart: always

Now the problem is that I don't know how to specify the stack's directory, if I follow my previous binding ./stacks, then I can get D:\myCompose\dockge\stacks\uptime-kuma\compose.yaml, but I don't know where the ./data bound in compose.yaml is.

If you use the absolute path D:\myCompose\dockge\stacks, I get another error

Error response from daemon: invalid volume specification: '/run/desktop/mnt/host/d/myCompose/dockge/stacks:stacks:rw': invalid mount config for type "bind": invalid mount path: 'stacks' mount path must be absolute
@louislam
Copy link
Owner

Yes, because of the path mapping issue on Windows, I would say currently Dockge's container is not supported on Windows.

I will add non-Docker method later for Windows.

@aliuq
Copy link
Author

aliuq commented Nov 19, 2023

Thanks for the reply.

@louislam louislam added the bug Something isn't working label Nov 21, 2023
@AmIBeingObtuse
Copy link

Hi

I run Dockge on docker desktop on windows 10 pro. I don't have any issues with mapping. Here is my compose file and converted run command that I use:

version: "3.8"
services:
  dockge:
    image: louislam/dockge:latest
    restart: unless-stopped
    ports:
      # Host Port:Container Port
      - "5032:5001"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "C:\Yourpath\Data:/app/data"
      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker:/root/.docker
      # Your stacks directory in the host (The paths inside container must be the same as the host)
      # ⚠️⚠️ If you did it wrong, your data could end up be written into a wrong path.
      # ✔️✔️✔️✔️ CORRECT EXAMPLE: - /my-stacks:/my-stacks (Both paths match)
      # ❌❌❌❌ WRONG EXAMPLE: - /docker:/my-stacks (Both paths do not match)
      - "C:\Yourpath\Stacks:/opt/stacks"
    environment:
      # Tell Dockge where is your stacks directory
      - `"DOCKGE_STACKS_DIR=/opt/stacks"`

Docker run command:

docker run -d `
  --name dockge `
  -p 5032:5001 `
  --restart unless-stopped `
  -v /var/run/docker.sock:/var/run/docker.sock `
  -v C:\Yourpath\Data:/app/data `
  -v C:\Yourpath\Stacks:/opt/stacks `
  -e DOCKGE_STACKS_DIR=/opt/stacks `
  louislam/dockge:latest

This stores my stacks in C:\Yourpath\Stacks\StackName\compose.yaml

Docker prompted me to confirm I was happy sharing the directory. If that doesn't happen for you, go into docker dekstop settings and resources to ensure the directory is listed as shared. I am also using hyper v not WSL.

Let me know if this helped. I'm assuming your using docker desktop on windows.

@aliuq
Copy link
Author

aliuq commented Nov 24, 2023

@AmIBeingObtuse Thanks your reply, can u try to add the belows compose.yaml to check the uptime-kuma data stored position?

version: "3.8"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
      - ./data:/app/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 13001:3001 # <Host Port>:<Container Port>
    restart: always

I also will try to use C: to store all stacks and data at tonight

@AmIBeingObtuse
Copy link

@AmIBeingObtuse Thanks your reply, can u try to add the belows compose.yaml to check the uptime-kuma data stored position?

version: "3.8"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
      - ./data:/app/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 13001:3001 # <Host Port>:<Container Port>
    restart: always

I also will try to use C: to store all stacks and data at tonight

Because I have mapped my paths in my compose as:

- "C:\Yourpath\Stacks:/opt/stacks"

and left the environmental variable as:

- `"DOCKGE_STACKS_DIR=/opt/stacks"`

Your compose file gets stored in:

- "C:\Yourpath\Stacks\UptimeKuma\compose.yaml"

for me.

I had to change your compose file to:

version: "3.8"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
      - C:\Yourpath\Uptimekuma:/app/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 13001:3001 # <Host Port>:<Container Port>
    restart: always

So I can persist the data and make it easier to access the files. But it did work fine via Dockge.

@louislam
Copy link
Owner

C:\Yourpath\Uptimekuma:/app/data

Yes, you are right. As long as it is a absolute path, it is ok to use, but I assume that most people will not aware this, so I claimed that Dockge is not supported on Windows at the moment.

@AmIBeingObtuse
Copy link

Surely its a standard mapping?

I don't think it needs any change at all. As long as the volume is mapped as shown it works fine. That doesn't mean its not windows supported.

Maybe just provide a note in the default compose file for example:

version: "3.8"
services:
  dockge:
    image: louislam/dockge:1
    restart: unless-stopped
    ports:
      # Host Port : Container Port
      - 5001:5001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data #Example On Windows you can map the volume as - C:\Yourpath\Dockge\Data:/app/data
        
      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker/:/root/.docker

      # Your stacks directory in the host (The paths inside container must be the same as the host)
      # ⚠️⚠️ If you did it wrong, your data could end up be written into a wrong path.
      # ✔️✔️✔️✔️ CORRECT: - /my-stacks:/my-stacks (Both paths match)
      # ❌❌❌❌ WRONG: - /docker:/my-stacks (Both paths do not match)
      - /opt/stacks:/opt/stacks #Example on windows you can map the volume as - C:\Yourpath\Dockge\Stacks:/opt/stacks
    environment:
      # Tell Dockge where is your stacks directory (If using windows keep this the same and see above for volume mapping).
      - DOCKGE_STACKS_DIR=/opt/stacks

IMO

@aliuq
Copy link
Author

aliuq commented Nov 24, 2023

I have a another question, if I used absolute path on dockge volumes

volumes:
  - "/var/run/docker.sock:/var/run/docker.sock"
  - "C:/Yourpath/Data:/app/data"
  - "C:/Yourpath/Stacks:/opt/stacks"
environment:
  - `"DOCKGE_STACKS_DIR=/opt/stacks"`

Need I use absolute path on all stacks volume which mapped data? e.g.

version: "3.8"
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
-     - ./data:/app/data
+     - C:/Yourpath/Uptimekuma:/app/data
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 13001:3001 # <Host Port>:<Container Port>
    restart: always

If uptime-kuma always need absolute path to bind mount /app/data, may dockge volumes use relative path instead of absolute path?

@AmIBeingObtuse
Copy link

AmIBeingObtuse commented Nov 24, 2023 via email

@holocronology

This comment was marked as outdated.

@AmIBeingObtuse

This comment was marked as outdated.

@holocronology
Copy link

I agree @AmIBeingObtuse.

@louislam I think the compose.yaml and other documentation should be updated to reflect this.

@louislam
Copy link
Owner

No, using 1 is the best.

1 is pointing the latest version of v1.

latest is a bad practice for most images:

https://stackoverflow.com/questions/72889955/is-it-bad-practice-to-use-mysqllatest-as-docker-image

@AmIBeingObtuse
Copy link

AmIBeingObtuse commented Dec 21, 2023

No, using 1 is the best.

1 is pointing the latest version of v1.

latest is a bad practice for most images:

https://stackoverflow.com/questions/72889955/is-it-bad-practice-to-use-mysqllatest-as-docker-image

I can understand why using the version number as the tag is best practice. I guess I'm used to devs posting only the latest stable version on that latest tag and using nightly for the latest unstable version.

I do use version tags for databases always. But I do agree with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants