Description
Description
It would be nice if .docker/config.json
has a configuration to convert
docker run -v /path/to/somewhere/foo:/workspace
to
docker run -v /anotherpath/foo:/workspace
automatically.
Background
My machine is Windows and I'm running a docker daemon on WSL2 distribution (Ubuntu-20.04). That's not Docker Desktop but a standard docker daemon for Ubuntu, installed following the instructions in https://docs.docker.com/engine/install/ubuntu/ .
WSL2 distribution can access Windows filesystems on /mnt/c
(via SMB). That means,
docker run -v /mnt/c/Users/ikedam/Desktop/work:/workspace ...
allows launch a container accessing files on Windows. I want to launch the container from Windows with:
docker run -v "C:\\Users\\ikedam\\Desktop\\work:/workspace" ...
or:
docker run -v ".\\work:/workspace" ...
This feature allows that.
Compared to Docker Desktop
Docker Desktop (for Windows) also provides a feature to bind-mount windows filesystems.
Pros in Docker Desktop:
- Rich UI.
- Provides everything for docker suite. It contains not only docker daemon, but also
docker
cli anddocker-compose
cli. - Easy to setup. Users don't have to know about details of docker backends.
- Docker feature gets available not only to Windows, but also to all WSL2 distributions.
- Auto port mapping for published port to the public IP address.
- Note:
127.0.0.1
on WSL2 is accessible also from Windows via127.0.0.1
. So this pros in Docker Desktop is only when the user wants to publish ports to a public network interface.
- Note:
- Transparent conversion between filesystems. E.g. running
docker inspect
on Windows outputsC:\\...
for bind mounts. This feature doesn't support that.
Cons in Docker Desktop
- Slow to start. (Maybe for GUI features?)
- Requires updating all components to update a specific component. For example, when I want to introduce the latest
docker-compose
for a bug fix, I have to wait for the next release of Docker Desktop and have to update not onlydocker-compose
but whole Docker Desktop. - No way to downgrade.
- Unfortunately, new versions of Docker Desktop so often introduce new bugs, and they are often critical ones. You can't downgrade to the previous version once you upgrade to a new version. And the only way to recover your Docker Desktop is to uninstall it once and reinstall the previous one. Of course, all data in docker (images, containers, volumes) are removed.
- Updating Docker Desktop is really risky for this reason.
- Docker Desktop is not a open-source and developers can't fix the problem nor find a workaround by themselves.
I believe Docker Desktop is useful, but often costs too much.
Configuration example
Just like the proxies
member in config.json
(https://docs.docker.com/network/proxy/#configure-the-docker-client):
{
"bindMaps": {
"default": {
"C:\\:/mnt/c/"
}
}
}
Activity