简体   繁体   中英

VScode docker - Can't attach to bash running the Docker container

The Docker extension for VS-code attaches /bin/sh to your containers by default. The settings file confirms this:

"docker.attachShellCommand.linuxContainer": "/bin/sh"

I have changed this in the settings editor of VS-code to attach to bash instead:

"docker.attachShellCommand.linuxContainer": "/bin/bash"

I expected to get /bin/bash as CLI when attaching to the container. Instead, it still attached me to /bin/sh .

In the meantime, I'm a day further and the behaviour of my shell has changed to the behaviour of /bin/bash. This is confusing.

After even more experimenting, I found out that I have a problem with the Chrome cache. I installed a clear-cache button in Chrome, which allowed me to clear the cache whenever I suspected this problem. Now I am in control. I did nothing wrong with the settings.

Question answered. :-)

I've had similar issues trying to use:

"docker.attachShellCommand.linuxContainer": "/bin/bash"

Getting and error:

    "The terminal process failed to launch: Path to shell executable "/bin/bash" does not exist.

Ended up reverting back to:

"docker.attachShellCommand.linuxContainer": "/bin/sh"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM