Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

db container fails to start with chmod error #24

Closed
gordontyler opened this issue May 25, 2016 · 10 comments
Closed

db container fails to start with chmod error #24

gordontyler opened this issue May 25, 2016 · 10 comments

Comments

@gordontyler
Copy link

[gtyler@torgtylervm1 mattermost-docker]$ docker-compose up db
Starting mattermostdocker_db_1
Attaching to mattermostdocker_db_1
db_1   | AWS_ACCESS_KEY_ID is required for Wal-E but not set. Skipping Wal-E setup.
db_1   | chmod: changing permissions of ‘/var/lib/postgresql/data’: Permission denied
mattermostdocker_db_1 exited with code 1

Running on Centos 7 with:

Docker:

Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 16:16:33 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 16:16:33 2016
 OS/Arch:      linux/amd64

And docker-compose:

docker-compose version 1.7.1, build 0a9ab35
docker-py version: 1.8.1
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
@eungjun-yi
Copy link
Contributor

Hmm.. postgres 9.5 is known to have the bug: docker-library/postgres#116

Did you modify the db Dockerfile to use postgres 9.5 instead of 9.4?

@gordontyler
Copy link
Author

Nope. I used the 4 line instructions from the docs (clone, link nossl config, compose up -d) and it failed with an error message saying it couldn't link the app container to the db container. So I tried the command I described in the OP to see what was failing in the db container.

@eungjun-yi
Copy link
Contributor

Would you please delete "- ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data" in your docker-compose.yml and run the container again?

@gordontyler
Copy link
Author

That worked.

@gordontyler
Copy link
Author

Although, now I have a separate issue, the app container shuts down after a minute:

[11:02:07 EDT 2016/05/25] [EROR] (main.main:79) Unable to load mattermost configuration file: Error opening config file=config.json, err=open config.json: no such file or directory

@eungjun-yi
Copy link
Contributor

I think you have problems of volume mounting. The error in app container also looks a volume problem because the container load config file from a volume.

Deleting all volume sections in docker-compose.yml may be a workaround but it is not a good long-term solution because you will lost all of data when the containers are removed.

Are you using selinux? Then you may try this solution.

@gordontyler
Copy link
Author

I'm not knowingly using selinux. Is it enabled by default in Centos 7?

@eungjun-yi
Copy link
Contributor

eungjun-yi commented May 25, 2016

I think so. I have used CentOS 4, 5, 6 and 7 and selinux was enabled in all of them. You may find the configuration in /etc/selinux/config or /etc/sysconfig/selinux.

@gordontyler
Copy link
Author

Okay, so after restoring the the postgresql/data volume in docker-compose.yml, I ran the following command:

sudo chcon --recursive --type=svirt_sandbox_file_t --range=s0 ./volumes/db/var/lib/postgresql/data

And then the db container was able to come up.

@gordontyler
Copy link
Author

Similarly, I had to run the same chcon command for the ./volumes/app/mattermost/config and ./volumes/app/mattermost/data folders to fix the app container error I mentioned earlier.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants