Problem with encrypted Python backend code – database not working in Docker

rohidas9730
Wed, 18 Jun 2025 06:50:52 +0000
Docker Hub

Hi,
I’m practicing deploying a full-stack app using Docker – with a React frontend, a FastAPI backend (Python), and a MySQL database. I want to protect my backend code by encrypting it so that when I share the Docker image, others can’t see the source code inside the container.

When I encrypt the backend code, the frontend and backend seem to work fine, but the database connection fails or doesn’t work properly.

Also, is there any method to prevent someone from entering the container and accessing the code or files? I want to make sure that even if someone runs the container, they cannot view the backend code or sensitive data.

How can I fix the database issue while keeping the backend code secure? Is there a recommended way to protect source code and data in Docker containers?

Thanks in advance!

4 posts - 3 participants