First time here? Check out the FAQ!
1

Docker remote host: OCI runtime exec failed: exec failed: unable to start container process: chdir to cwd

I'm trying to configure a new project to use a docker environment, but Wing's python doesn't seem to launch correctly. In the logs, I see references to my home directory, which doesn't exist in the container.

Is there some configuration that tells wing what cwd to use inside the container?

More info:

Wing launches a container successfully (I'm able to exec into it myself), but when I select restart shell in wing's python directory, this message appears in the python window:

OCI runtime exec failed: exec failed: unable to start container process: chdir to cwd ("/home/rutherford") set in config.json failed: no such file or directory: unknown further, I see the following in ide.log:

popenE with ['docker', 'exec', '-w', '/home/rutherford', ...

/home/rutherford is my home directory (on the host machine). It doesn't exist in the container.

Tmr's avatar
35
Tmr
asked 2024-10-30 17:42:04 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2024-11-05 05:32:40 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

The current directory to use is set with WORKDIR in the Dockerfile. You may also need to set up a file mapping from the host-side directory to that directory in the container configuration in Wing.

One idea is to create a new project from the Project menu and create a new directory and on the second dialog screen a new environment using Docker. That produces a working configuration which you can then compare to what you have. You can run Wing with the --new command line arg to create multiple instances of Wing, so it's easier to do that.

The How-To for using Wing with Docker is at https://wingware.com/doc/howtos/docker in case you didn't already know that. That may also help.

Wingware Support's avatar
4.2k
Wingware Support
answered 2024-10-30 19:11:48 -0600
edit flag offensive 0 remove flag delete link

Comments

I have tried setting WORKDIR, but I don't think that's the issue here. Note that Wing is logging ['docker', 'exec', '-w', '/home/rutherford'], so I think the bad path is coming from wing. Also note that the docker image works fine (I am able to exec to it myself).

Tmr's avatar Tmr (2024-10-31 14:02:33 -0600) edit

This probably indicates that you don't have a an entry to map /home/rutherford to /app or whatever it's supposed to be on the container. This is done with File Mappings under the General tab of the container configuration in Wing.

I was surprised we send -w but now I see that we do and it's sending the configured debug environment's run directory passed through the container file mapping, so it does look like that's the issue and adding an entry for /home/rutherford -> /app or similar should solve it. Please let me know if not.

Wingware Support's avatar Wingware Support (2024-10-31 17:28:12 -0600) edit

I don't have an entry to map /home/rutherford into the container, but I also don't want it to be mapped! Can I not use a container without mapping any directories into it? In this case the code I want to use is already in the container.

Tmr's avatar Tmr (2024-10-31 17:45:58 -0600) edit

How are the files edited? Wing's container support assumes files are mapped from somewhere on the host into the container. It then maps the container-side locations back to the host-side locations so it can show the file that can actually be edited on the local host. It doesn't try to edit files on the container because very often the container is short-lived and you would lose you edits.

If the container is being used more like a remote host that you can ssh into then you may just want to treat it that way instead in Wing, as described in https://wingware.com/doc/howtos/remote-…

BTW you could set the initial directory to a different value from Edit Environment in the Python Shell's Options menu but that will reject anything that doesn't exist on the host so this is probably not the right approach and not useful.

Wingware Support's avatar Wingware Support (2024-10-31 18:10:06 -0600) edit

I was actually just trying to use Wing to view (and maybe debug) the files in the container. I had no plans to edit them in the short term.

But I think this answers my question. My initial directory is set to default, which the documentation suggests is ${WING:PROJECT_DIR}. Perhaps, as the project dir does not exist in the container, Wing falls back to ~ as the initial directory? This suggests that it would work as I expect if I could set Wing's initial directory to be the containers WORKDIR. However, when I am using a container environment, the initial directory option is greyed out.

Tmr's avatar Tmr (2024-11-01 13:03:14 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer