-1

I'm trying to run a Docker container based on a Python script that converts .pptx files to .rtf files using pypandoc. The Dockerfile sets /bin/bash as the default command, allowing interactive access to the container. However, I'm facing difficulties in accessing /bin/bash inside the running container.

Dockerfile:

FROM ubuntu:20.04

RUN apt-get update && apt-get install -y python3.9 python3-pip pandoc bash

WORKDIR /app

COPY pptx_to_rtf.py /app/
COPY *.pptx /app/

RUN pip install python-pptx pypandoc

CMD ["/bin/bash", "-c", "python pptx_to_rtf.py & tail -f /dev/null"]

Issue: When I attempt to access the container using docker exec -it RTF_converter /bin/bash, I receive the error message: OCI runtime exec failed: exec failed: unable to start container process: exec: "C:/Program Files/Git/usr/bin/bash": stat C:/Program Files/Git/usr/bin/bash: no such file or directory: unknown.

I've also tried using /bin/sh as the default command in the Dockerfile, but the issue persists. I'm running this on a Windows machine.

Any insights or suggestions on how to properly access /bin/bash or /bin/sh inside the Docker container would be greatly appreciated. Thank you!

larsks
  • 277,717
  • 41
  • 399
  • 399
Bosser445
  • 303
  • 1
  • 9
  • That looks like a Windows path; maybe it needs an explicit `bash.exe`? – Shawn Jul 24 '23 at 22:40
  • The `C:` part looks strange to me. If you would be using Cygwin, this would be fine, because cygwin is able to deal with `c:` to some extent, bue you tagged the question as _ubuntu_, and this I conclude that you are using WSL. In essence, the path specified to bash does not exist, but I don't know how docker comes to the idea of using this path. Perhaps a configuration problem? In any case, this does not seem to be a programming question, and you will probably get help at [su]. – user1934428 Jul 25 '23 at 07:38
  • Aside from this: Just before issuing the `docker` command, do a `echo $PATH`. Do you have somewhere an entry with the silly `C:/....`? – user1934428 Jul 25 '23 at 07:39
  • Do the workarounds in [Why I get exec failed: container_linux.go:380 when I go inside Kubernetes pod?](https://stackoverflow.com/questions/69885795/why-i-get-exec-failed-container-linux-go380-when-i-go-inside-kubernetes-pod) help you? That has the same error in a `kubectl exec` rather than a `docker exec` context, but a non-container-related cause. – David Maze Jul 25 '23 at 10:25
  • (Do you need `docker exec` or `bash` at all? Can you set the main container command to just run the script and let the container exit when it's done?) – David Maze Jul 25 '23 at 10:25

1 Answers1

1

Try one of the following commands :

(export MSYS_NO_PATHCONV=1; docker exec -it RTF_converter /bin/bash)

or

docker exec -it RTF_converter //bin/bash

or

docker exec -it RTF_converter \/bin/bash

to see which one works? ( I can't test as I dont have the same environment)

Philippe
  • 20,025
  • 2
  • 23
  • 32