Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Docker running script but server doesn't work

I am doing an encryption service that everytime a user goes on the server it changes the key , the problem is that when i run the python file alone in works like this
when it works

but when I am dockerizing it by the below code

FROM python:3

RUN mkdir -p "C:\Users\joel\Desktop\mcast-freshers-week-devops-main\mcast-freshers-week-devops-main\encryption-service"

COPY requirements.txt ./
RUN pip install -r requirements.txt


COPY . .
CMD [ "python", "app.py" ]

The build and run are succesful even the container it is being created , even the output from the python code is shown
enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

but when i go to the server it shows this
enter image description here

I tried everything but I don’t know what to do.

I treid changing the code many times but i still cant solve it , I narrowed it down because i tried another python application and it worked.

>Solution :

When you run your command with docker run, you can always expose the internal port on the docker container to match your local host network port, use this command instead for running your docker container

docker run -it --rm -p 8080:8080 --name my-running-app my-python-app

You can then access your server by visiting localhost:8080

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading