Fix firewalld reload in Docker deployment#1
Open
erfansahaf wants to merge 1 commit into
Open
Conversation
- Install firewalld client in container to communicate with host's firewalld daemon - Mount firewalld socket from host into container - Run container as root to access the socket - Improve error handling in reload endpoint with proper JSON responses - Update docker-compose.yml with socket mount configuration - Update documentation with Docker deployment instructions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the firewalld reload functionality when running the application inside a Docker container.
Problem
The original implementation tried to call
firewall-cmd --reloadinside the Docker container, but:/var/run/firewalld/)firewall-cmdclient wasn't installed in the containerSolution
apt-get install -y firewalldto install the firewalld client (not the daemon) inside the container/var/run/firewalld:/var/run/firewalldvolume mount in docker-compose.yml to expose the host's firewalld socket to the containerUSER rootin Dockerfile to ensure proper permissions to access the socket/reloadendpoint to return proper JSON responses with helpful error messagesHow it works
When running in Docker:
firewall-cmdinstalled (client only)/reloadis called, it uses the mounted socket to communicate with the host's firewalld daemon over DBusTesting
The changes have been made locally. To test:
docker compose up --build