Closed jpcmadeira closed 4 years ago
Same problem here :) I hope the PR can be merged / released soon, thanks
After upgrading to the latest verison of docker toolbox for windows, the problem is gone, thanks for your work :):)
This was not merged yet. Did you implement my changes or did a new docker toolbox version came out?
I don't remember on which version I was, but I uninstalled, installed the last version of the toolbox n recreated my docker machine on VirtualBox as well and it's working.
Thanks for the report @jmadeira95 and @RemiBou!
@RemiBou can you please check which version of Compose you used?
here is my compose file https://github.com/RemiBou/Toss.Blazor/blob/master/docker-compose.yml (just comment the mac part on the secrets for the MS part), I didn't change the compose version. This evening I'll try to find the previous version of docker toolbox on my personal computer download folder. I installed it 1 year ago I'd say.
I am having this issue too. Any update on this?
@jmadeira95, have you tried replacing your paths to
C\:\\Users\\Joaom\\teste\\secrets\\password
C\:\\Users\\Joaom\\teste\\secrets\\user
or
Users/Joaom/teste/secrets/password
Users/Joaom/teste/secrets/user
Yes i did try that @Saw-mon-and-Natalie
For my case, I had to make sure the Virtual Box
my docker
runs on has access to those folders. You might need to create some shared folders.
cd C:/Program Files/Oracle/VirtualBox
# ^^ over wherever your VirtualBox binaries are located.
./VBoxManage.exe sharedfolder add default --name "path/to/mount/folder/on/docker/vm" --hostpath "\\?\x:\path\to\folder" --automount
default
in the command above is the name of the docker
virtual box. In your case you might need to type this:
./VBoxManage.exe sharedfolder add default --name "/c/Users/Joaom/teste" --hostpath "\\?\c:\Users\Joaom\teste" --automount
This article might help: Docker Toolbox, Windows 7, and Shared Volumes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it had not recent activity during the stale period.
Sorry if I'm missing something, but if this has been closed, what is the solution to using secret files on Windows with Docker Toolbox?
Hi @Virakal,
I'd recommend using Docker Desktop for Windows instead of Docker Toolbox.
@chris-crone Thank you, but I'm afraid that's not an option for me because Hyper-V breaks other apps that I need. Does Compose not support Toolbox?
Hi @chris-crone, I experiences the same issue. I'm using Windows 8.1 so I can only make use of Docker Toolbox.
@Virakal Compose should work with Toolbox but Docker Desktop is really the preferred way to run Docker on Windows. What app are you using that will break if you use Hyper-V?
@soma99 Curious why you're using Windows 8?
@chris-crone I need Virtualbox for various projects (I'm aware VBox can theoretically work with Hyper-V enabled but last time I tried it wouldn't work on most machines, including mine, and was reported to be extremely slow and unsupported); Vagrant, which I have tried with Hyper-V but found it to be an awful experience; and Android emulators, where the only Hyper-V compatible one I'm aware of doesn't perform well enough for my needs.
@chris-crone The last laptop I bought 5-6 years ago came with Windows 8 (OEM) and I've been using this laptop for local development since then. If I had a choice when I bought it back then, it would properly be running Windows 7, my preferred edition of Windows.
Given that there still seems to be no solution for this, is there a way to request this issue be repoened, or should I open a new issue linking to this one?
It's 2023 but the issue still here. I'm using Docker Desktop v4.19.0 (docker v23.0.5
and docker-compose v2.17.3
) with the following compose.yaml
file:
services:
telebot:
image: ...
secrets:
- tg_bot_token
environment:
TELEGRAM_BOT_TOKEN: /run/secrets/tg_bot_token
...
secrets:
tg_bot_token:
file: telebot.token
and when launching docker-compose up
, I'm getting the following:
[+] Running 0/1
- Container a19fccf13764_telebot Recreate 0.2s
Error response from daemon: invalid mount config for type "bind": invalid mount path: 'c:/lang/stegotext/telebot/telebot.token' mount path must be absolute
I've tried various forms of the secret path:
telebot.token
./telebot.token
c:/absolute/path/telebot.token
c:\absolute\path\telebot.token
c:\\absolute\\path\\telebot.token
but the result stays the same.
@jpcmadeira, @chris-crone , since the attached PR was not merged, is there a workaround or another issue that's hopefully will be addressed?
@Toparvion I ran into this issue today as well. Here's the solution I came up with...
services:
myservice:
image: mcr.microsoft.com/windows/nanoserver:ltsc2022
command: ["cmd.exe", "/C", "type", "C:\\ProgramData\\Docker\\secrets\\mysecret.txt"]
secrets:
- source: mysecrets
target: C:\ProgramData\Docker\secrets\
secrets:
mysecrets:
file: secrets
Here's the output of docker compose up
docker compose up
[+] Running 1/0
✔ Container temp-myservice-1 Created 0.0s
Attaching to temp-myservice-1
temp-myservice-1 | I like pineapple on pizza.
temp-myservice-1 exited with code 0
In this example, I have a secrets folder with a file named mysecret.txt
inside. docker compose
mounts the whole folder to C:\ProgramData\Docker\secrets\
, and any files in the folder are made available in the container.
I'm not sure if this is how it's intended to work for Windows containers but it'll work just fine for my purposes.
@joshooaj , I've transformed my compose.yaml
file according to your comment:
services:
telebot:
image: ...
secrets:
- source: tg_bot_token
target: /run/secrets/
environment:
TELEGRAM_BOT_TOKEN: /run/secrets/tg_bot.token
# ...
secrets:
tg_bot_token:
file: secrets
, where secrets
is a folder next to compose.yaml
file containing the secret tg_bot.token
file.
Unfortunately, the result hasn't changed:
c:\lang\stegotext\telebot>docker compose up
[+] Running 0/1
- Container telebot Recreate 0.2s
Error response from daemon: invalid mount config for type "bind": invalid mount path: 'c:/lang/stegotext/telebot/secrets' mount path must be absolute
I think the difference is in the fact that I'm using Windows not inside but outside the container, i.e. on the host machine, and Docker for some reason fails to resolve the path to the secret in this format.
Anyway thanks for the suggestion!
Is there a workaround for this issue? I have the same set up as @Toparvion and docker compose still fails to mount secrets located on my host Windows machine.
For me the same. But only with Docker Version 26.1.3 on Linux
With docker Linux 24.0.9 and Windows 24.0.6 everything is working like expected.
Description of the issue
Docker compose does not convert secrets source path correctly while using docker toolbox (virtualbox).
Context information (for bug reports)
Output of
docker-compose version
Output of
docker version
Output of
docker-compose config
(Make sure to add the relevant-f
and other flags)Steps to reproduce the issue
Observed result
Secrets are not mounted in the container, because compose is not converting path from Windows to unix Style correctly like it does for volumes.
Expected result
secrets to be mounted successfully.
Stacktrace / full error message