Permission problem docker compose
Answered
My TC server worked well. Problem occurred when I accidentally rewrote docker-compose file. Then teamcity-server docker container failed. I return initial code back, but now, when I am trying start container I get:
/run-services.sh
/services/check-server-volumes.sh
>>> Permission problem: TEAMCITY_DATA_PATH '/data/teamcity_server/datadir' is not a writeable directory
>>> Permission problem: TEAMCITY_LOGS '/opt/teamcity/logs' is not a writeable directory
Looks like some mandatory directories are not writable (see above).
TeamCity container is running under 'tcuser' (1000/1000) user.
A quick workaround: pass '-u 0' parameter to 'docker run' command to start it under 'root' user.
The proper fix: run 'chown -R 1000:1000' on the corresponding volume(s), this can take noticeable time.
If the problem persists after the permission fix, please check that the corresponding volume(s)
are not used by stale stopped Docker containers ("docker container prune" command may help).
I tried other solutions like deleting docker container, docker volume prune, docker container prune, all recommendation from error output . But it doesn't help.
Part of my docker-compose code:
teamcity-server:
container_name: "teamcity-server"
image: "jetbrains/teamcity-server"
ports:
- "8111:8111"
# command: sh -c "chown -R 1000:1000 /opt/teamcity/logs?"
# command:
# - /bin/bash
# - -c
# - chown -R 1000:1000 /opt/teamcity/logs
# - chown -R 1000:1000 /opt/teamcity/data
environment:
- "TEAMCITY_CONTEXT=/teamcity/"
volumes:
- /opt/teamcity/logs:/opt/teamcity/logs
- /opt/teamcity/data:/data/teamcity_server/datadir
Please sign in to leave a comment.
The error indicates a permissions issue for the two volumes within the container. If you run "docker start -it -u 0 <teamcity-server container>" (this will start the container as root) you should be able to determine what the permissions are on these volumes with "ls -l". From here you could also execute "the proper fix" as described in the output you've shared.
This works for me!