Docker(Docker Desktop for Windows)でguiを描画する試験をした結果、成功したので公開。 WSLを用います。
方法は2通りあります。 どちらでも結果は同じです。
DockerGuiTest/ 内で、コマンドを実行
docker-compose up -d
DockerGuiTest/notCompose/ 内で、コマンドを実行
docker build \
--build-arg DISPLAY=$DISPLAY \
--build-arg PULSE_SERVER=$PULSE_SERVER \
--build-arg WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
--build-arg XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
. -t image-name
docker run \
-v /mnt/wslg:/mnt/wslg \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-it --rm image-name
compose.yml は docker-compose.yml と同じ役割です。 こちらに関しては 公式ドキュメント を参照してください。
日本語で記事を書きました。 時間かけた? かかった? ので読んでもらえると嬉しいです。 wslのDockerでGUI操作 | qiita.com
I tested drawing gui with Docker(Docker Desktop for Windows) and it was successful, so I published the file. Use WSL.
There are two methods. The result is the same in both cases.
In DockerGuiTest/, execute the command
docker-compose up -d
In DockerGuiTest/notCompose/, run the command
docker build \
--build-arg DISPLAY=$DISPLAY \
--build-arg PULSE_SERVER=$PULSE_SERVER \
--build-arg WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
--build-arg XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
. -t image-name
docker run \
-v /mnt/wslg:/mnt/wslg \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-it --rm image-name
compose.yml has the same role as docker-compose.yml. See official documentation for more information.
I wrote an article about what is related to this repository, though it is in Japanese. I took time to write it, and I hope you will read it. wslのDockerでGUI操作 | qiita.com