Container (original) (raw)

How are containers isolated from the host in Docker Desktop?

Docker Desktop runs all containers inside a customized / minimal Linux virtual machine (except for native Windows containers). This adds a strong layer of isolation between containers and the host the machine, even if containers are running rootful.

However note the following:

To which portions of the host filesystem do containers have read and write access?

Containers can only access host files if these are shared via Settings -> Resources -> File Sharing, and only when such files are bind-mounted into the container (e.g., docker run -v /path/to/host/file:/mnt ...).

Can containers running as root gain access to admin-owned files or directories on the host?

No; host file sharing (bind mount from the host filesystem) uses a user-space crafted file server (running in com.docker.backend as the user running Docker Desktop), so containers can’t gain any access that the user on the host doesn’t already have.