New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci runtime error: container_linux.go:247; not a directory #231

Closed
calvinmqc opened this Issue Feb 23, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@calvinmqc

calvinmqc commented Feb 23, 2018

Description of problem

When trying to install kiwi with the "docker-compose up -d" command, I received the error message below:

ERROR: for kiwi_web Cannot start service web: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/root/kiwi/contrib/ssl/kiwi-https.crt\" to rootfs \"/var/lib/docker/overlay2/3b1fce1add8fe03675aa0cd26b1d765cc4c3ce993c4a7a9a9becdc0a5dfffefc/merged\" at \"/var/lib/docker/overlay2/3b1fce1add8fe03675aa0cd26b1d765cc4c3ce993c4a7a9a9becdc0a5dfffefc/merged/etc/pki/tls/certs/localhost.crt\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for web Cannot start service web: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/root/kiwi/contrib/ssl/kiwi-https.crt\" to rootfs \"/var/lib/docker/overlay2/3b1fce1add8fe03675aa0cd26b1d765cc4c3ce993c4a7a9a9becdc0a5dfffefc/merged\" at \"/var/lib/docker/overlay2/3b1fce1add8fe03675aa0cd26b1d765cc4c3ce993c4a7a9a9becdc0a5dfffefc/merged/etc/pki/tls/certs/localhost.crt\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

Component (web, API, etc)

Web; docker-compose.yml

How often reproducible

Every time I run it on Centos 7

Steps to Reproduce

Follow the steps on the page:
http://kiwitcms.readthedocs.io/en/latest/installing_docker.html

Solution

I modified the docker-compose.yml file as below, then ran it again and it worked well.

Original:
volumes:
- uploads:/var/kiwi/uploads
- ./contrib/ssl/kiwi-https.crt:/etc/pki/tls/certs/localhost.crt
- ./contrib/ssl/kiwi-https.key:/etc/pki/tls/private/localhost.key

Updated:
volumes:
- uploads:/var/kiwi/uploads
- ./contrib/ssl/kiwi-https.crt:/merged/etc/pki/tls/certs/localhost.crt
- ./contrib/ssl/kiwi-https.key:/merged/etc/pki/tls/private/localhost.key

There is no directory named as "merged" inside the docker container, so it always failed.
For more info about the settings here, please go to the page below about bind mounts:
https://docs.docker.com/storage/bind-mounts/

Hope this helps you when you encounter similar error message!

Anyway, I do not understand why the sample docker-compose.yml file does not include "merged".

@atodorov

This comment has been minimized.

Member

atodorov commented Feb 24, 2018

Every time I run it on Centos 7

The docker version on CentOS 7 and RHEL 7 is older than upstream and does not support mounting of files. It only supports mounting of directories.

I will update the docker-compose.yml file to take care of this however it may not resolve the problem for you. If you decide to mount a local_settings.py file onto product.py inside the container (to override settings without rebuilding the image) then you will hit the same problem.

The only other way is to upgrade your docker to something newer.

atodorov added a commit that referenced this issue Feb 24, 2018

Move SSL keys under common directory in the container. Fix #231
The problem is that some older versions of docker do not allow
mounting of files between the host and the container, they only
allow mounting directories and volumes. The stock docker versions
on CentOS 7 and RHEL 7 do this. You may see a similar error:

ERROR: for kiwi_web Cannot start service web:
    OCI runtime create failed: container_linux.go:348:
        starting container process caused "process_linux.go:402:
            container init caused "rootfs_linux.go:58: mounting
                "/root/kiwi/contrib/ssl/kiwi-https.crt" to
                rootfs "/var/lib/docker/overlay2 ....

To work around this problem I've moved the ssl certificates into
a common directory, mount that into the container and updated the
file paths where necessary.

WARNING: If you decide to override settings you will have to either
mount the settings file into the container or COPY that file and
rebuild the image!

@atodorov atodorov closed this in ce85ea2 Feb 25, 2018

@calvinmqc

This comment has been minimized.

calvinmqc commented Feb 26, 2018

Thanks for your comments. I think I already have the new version. Which version I suppose to install?

[root@localhost ~]# docker --version
Docker version 18.02.0-ce, build fc4de44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment