Configuration Details for Docker with Wing Pro
File Mappings
Wing uses the -v command line option when it starts Docker containers, in order to set up a file mapping that makes Wing's installation directory available inside the container. Docker ignores these without printing any notice if the host-side directory in the mapping is not a child, grand-child, or otherwise enclosed by one of the directories listed in the File Sharing setting under Settings > Resources in Docker Desktop. This results in complete failure of Wing's Docker integration.
Whether this is a problem depends on where Wing was installed on the host and what the default File Sharing settings are. If you install Wing somewhere under your home directory, and /Users (Windows and macOS) or /home (Linux) is already in the File Sharing list, then Docker already allows mapping all sub-directories of those and you don't need to add to the configuration.
In other cases, you will need to add Wing's installation directory to the Settings > Resources > File Sharing setting in Docker Desktop. This directory is listed in Wing's About box.
File Ownership and Security on Linux
If you are running Docker as a non-root user on Linux, files created container-side in mapped directories will appear on the host as being owned by root, or whatever user is running container-side. This can cause confusion, if you need to also access those files on the host system. The solution is to use 'sudo' to change file ownership, or when editing, viewing, or removing those files.
This problem occurs when you use -v on the Docker command line, or by setting up File Mappings in the Docker container configuration in Wing Pro. It will affect any files your code creates in mapped directories, and also impacts some of Wing's features, including:
- When creating a new project for Django, Flask, and some other frameworks, Wing may write configuration and debugging support files into the source directory.
- When code coverage is enabled, a persistent cache that outlives the container instance is created in the first mapped directory found in the container configuration.
Note that if you are running Docker as a non-root user on Linux, you by definition have full root access to the host system. Although enabling non-root users to use Docker is accomplished just by adding that user to the 'docker' group on the host, once this is done that user could use a container to gain full root access to the host, by copying or creating an executable on the container and using 'setuid' so the executable runs as root on the host as well.
Networking on Linux Hosts
When Docker is running on a Linux host, it starts containers using a different networking mode than the one used by Docker Desktop on Windows and macOS. This mode prevents connections from the container to the host system, which prevents Wing from inspecting and debugging the containers.
To work around this problem, Wing starts containers on Linux using host networking mode. In this mode, the container can connect to the host using 127.0.0.1.
Currently there is no way to override this behavior. Please contact us at support@wingware.com if this does not work with your container.