So I have a directory that just includes a Dockerfile
. I want to experiment with the poetry package in python. So I do not want any python files to be inside it initially because I want to create a poetry project from scratch inside the directory. So ı went ahead and built the image called local:python3.10ubuntu
for it. When I ran the container for it with the command docker run --name py3.10ubuntu local:python3.10ubuntu
I can see that the docker container was not running why is that and how would I be able to run it. when I try to see the docker logs for the container it wouldnt show anything as well. Besides starting the container how would I be able to run the command shell within the container and run python files?
Directory Structure:
.
└── Dockerfile
Dockerfile contents
FROM python:3.10-slim
RUN pip install --no-cache-dir poetry
CodePudding user response:
Your dockerfile is not configured properly try to refer below website on how to create a docker file for poetry.
Also to run a shell script in dockerfile it could be done if your code has a .sh file. You could either use RUN, ENTRYPOINT, CMD or combination of these to run the shell script in your docker file.Refer the below answer
Using ENTRYPOINT to run shell script in dockerfile
To run a docker container you can use
docker run -it <docker-image>
Try exec command to run something inside the container
docker exec -it <container-name-or-id> bash
CodePudding user response:
ughhhh?
docker run -ti <your_image>
or if you want see more than python itself:
docker run -ti --entrypoint /bin/bash <your_image>