Docker: Python 3.6, git and Bash

Hello Folks, is someone able to deal with Docker? I'm not experienced here but now how to install it on Debian and how to run a Python REPL with a specific Python version. I install on Debian 11 sudo apt install docker docker.io Then I run the container sudo docker run -it --rm python:3.6 Now where I need help. I don't want to run the REPL. I want to begin in a bash shell because I need to do "git clone" (or mounting something from host?) and need to run unittest scripts. Has anyone a tip for me? I assume my problems root in the fact that I lack of deeper understanding of Docker concept and its UI. Kind Christian

Dear Christian, You need to run the container in interactive mode to achieve what you want. That should be sudo docker container run --interactive --tty --rm python:3.6 bash Also, you can "mount" your local folders (e.g. your git folder) to the container to directly access it from inside the container. Assuming you're root, the command will be: docker container run --interactive --tty --rm --volume localpath:containerpath python:3.6 bash I'm not sure about the order or the paths for --volume, give it a try. Cheers, Hakan On 11.05.2023 16:58, c.buhtz@posteo.jp wrote:

Dear Hakan, thanks for helping out. I still had problems to get BIT run in a container. The reason most was outdated depending packages etc. I gave it up and created a minimal working example (MWE) script to reproduce the error I tried to investigate. Then I created a Dockerfile FROM python:3.6 RUN python -m pip install pytest COPY callargs.py . CMD ["./callargs.py"] The "callargs.py" script is my MWE. Then I build the container: sudo docker build -t Foobar . And I run the script in the container sudo docker run -t Foobar Kind Christian

Dear Christian, You need to run the container in interactive mode to achieve what you want. That should be sudo docker container run --interactive --tty --rm python:3.6 bash Also, you can "mount" your local folders (e.g. your git folder) to the container to directly access it from inside the container. Assuming you're root, the command will be: docker container run --interactive --tty --rm --volume localpath:containerpath python:3.6 bash I'm not sure about the order or the paths for --volume, give it a try. Cheers, Hakan On 11.05.2023 16:58, c.buhtz@posteo.jp wrote:

Dear Hakan, thanks for helping out. I still had problems to get BIT run in a container. The reason most was outdated depending packages etc. I gave it up and created a minimal working example (MWE) script to reproduce the error I tried to investigate. Then I created a Dockerfile FROM python:3.6 RUN python -m pip install pytest COPY callargs.py . CMD ["./callargs.py"] The "callargs.py" script is my MWE. Then I build the container: sudo docker build -t Foobar . And I run the script in the container sudo docker run -t Foobar Kind Christian
participants (2)
-
c.buhtz@posteo.jp
-
Hakan Bayındır