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
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.
CodePudding user response:
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