Unresolved reference when using Docker remote interpreter
已回答
When I create a remote Docker interpreter using docker compose, the IDE shows Python imports as unresolved references despite showing all the required packages in the Python Packages window. Below is the example how in built Python modules are not resolved along with the requests module which IDE shows as installed.

I tried:
- invalidating cache and restarting
- pruning docker system and manually removing all containers, images and volumes
- removing JetBrains cache dir manually
- removing .idea folder from the project
- adding the `/usr/local/bin/python3.xx` and `/usr/local/bin/python3.xx/site-packages` to the interpreter path manually
None of the above resolved the issue.
I noticed an error in the logs which I suspect causes the underlying issue but I don't know how to address it:
2024-04-02 10:01:09,714 [ 15441] WARN - #c.j.p.s.PythonSdkUpdater - Update for SDK Remote Python 3.11.7 Docker Compose (fastapi) failed
The following command was executed:
/usr/local/bin/python3 /opt/.pycharm_helpers/remote_sync.py /tmp/a1fabe8f-226e-422e-8a50-8422c7da8573
The exit code: 1
The error output of the command:
time="2024-04-02T10:01:09+02:00" level=warning msg="The \"BUILD_DOCUMENTATION\" variable is not set. Defaulting to a blank string."
time="2024-04-02T10:01:09+02:00" level=warning msg="The \"BUILD_VERSION\" variable is not set. Defaulting to a blank string."
time="2024-04-02T10:01:09+02:00" level=warning msg="The \"BUILD_DOCUMENTATION\" variable is not set. Defaulting to a blank string."
time="2024-04-02T10:01:09+02:00" level=warning msg="The \"BUILD_VERSION\" variable is not set. Defaulting to a blank string."
time="2024-04-02T10:01:09+02:00" level=warning msg="/home/piotr/dyvenia/atttiva/etc/docker/docker-compose.yaml: `version` is obsolete"
time="2024-04-02T10:01:09+02:00" level=warning msg="/home/piotr/.cache/JetBrains/PyCharm2023.3/tmp/docker_compose/docker-compose.override.5.yml: `version` is obsolete"
Volume "atttiva_4d650284-d4b5-462a-84f2-4f60c98604ad" Creating
Volume "atttiva_4d650284-d4b5-462a-84f2-4f60c98604ad" Created
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/tmp/remote_sync17673307365622974291" to rootfs at "/tmp/0b4612fd-a4bc-43e5-934e-33656f069a9e": mkdir /var/lib/docker/overlay2/8b4a22f3d3e22ea51f637e3d5009b0ddb54815559be3b68231beccd013a1ab0f/merged/tmp/0b4612fd-a4bc-43e5-934e-33656f069a9e: read-only file system: unknown
请先登录再写评论。
It looks like there was an error when creating the container, which would explain why it shows the unresolved reference as the interpreter is not valid.
Check out the following possible solutions on Linux which appears to be very similar to your case - https://stackoverflow.com/questions/72695311/failure-starting-docker-container-failed-to-create-shim-task-oci-runtime-crea
Thanks for a quick answer. The answers from SO didn't apply directly to my case but they turned out to be a good lead. In my docker-compose, the `/tmp` was set to read-only. Removing this constraint resolved the issue.