Fedora32安装Harbor2.0.2遇Docker SELinux重标记错误求助
Alright, let's tackle this issue you're facing with Harbor 2.0.2 on Fedora 32. That error about SELinux relabeling / makes sense because SELinux never allows relabeling the root directory—even when you temporarily disable it with setenforce 0, Docker might not pick up the change right away, or there could be a misconfiguration in Harbor's setup pointing to the root path by mistake.
Here's how to fix this step by step:
Step 1: Check Harbor's Configuration for Path Mistakes
First, head into your extracted Harbor directory and open the harbor.yml file. Look for any configuration fields that might be incorrectly set to /—these are the usual culprits:
data_volume: This should point to a dedicated directory for Harbor's data (default is./data, not/)- Log paths under individual components (like
logentries for core, registry, etc.)
If you find any field set to /, update it to a valid subdirectory (e.g., ./harbor-data or /var/lib/harbor), save the file, and try running sudo ./install.sh again.
Step 2: Restart Docker to Pick Up SELinux's Permissive Mode
Running setenforce 0 switches SELinux to permissive mode, but Docker daemon doesn't automatically refresh this setting. Restart Docker to make sure it recognizes the change:
sudo systemctl restart docker
Once Docker is back up, re-run the Harbor installer:
sudo ./install.sh
Step 3: Disable SELinux Support in Docker (If Needed)
If the above steps don't work, you can explicitly turn off SELinux integration in Docker's configuration:
- Create or edit
/etc/docker/daemon.jsonand add this content:
{ "selinux-enabled": false }
- Restart Docker to apply the change:
sudo systemctl restart docker
- Try running the Harbor installer again.
Step 4: Verify SELinux is Actually in Permissive Mode
Just to be sure, check if SELinux is truly disabled temporarily:
getenforce
You should see Permissive in the output. If it says Enforcing, your setenforce 0 command didn't take effect—this might happen if your system has SELinux locked down (you may need to edit /etc/selinux/config to set SELINUX=permissive and reboot, but that's a permanent change).
内容的提问来源于stack exchange,提问作者Dolphin

