marcelbirkner / docker-ci-tool-stack

Docker Infrastructure via docker-compose (Jenkins, SonarQube, Nexus, GitLab, Selenium Grid)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with Native docker on Mac

sudhar99 opened this issue · comments

I am using native docker (1.12) on Mac. Had some volume mount issue in Sonar and opt directories. Resolved them thru "Preferences -> File Sharing". But now I am getting the following error

$ sudo docker-compose up -d
Password:
Removing dockercitoolstack_jenkins_1
dockercitoolstack_gitlab_1 is up-to-date
Starting dockercitoolstack_seleniumhub_1
Starting dockercitoolstack_sonardb_1
Starting dockercitoolstack_nexus_1
Starting dockercitoolstack_nodechrome_1
Starting dockercitoolstack_nodeff_1
Starting dockercitoolstack_sonar_1
Recreating e6bbf4cc74e7_e6bbf4cc74e7_dockercitoolstack_jenkins_1

ERROR: for jenkins Cannot start service jenkins: oci runtime error: rootfs_linux.go:53: mounting "/var/lib/docker/aufs/mnt/ee94f1a509f954c149105fef34ef5218cf27dea3ce16a3a9bdeee037b7a84f5e/usr/bin/docker" to rootfs "/var/lib/docker/aufs/mnt/ee94f1a509f954c149105fef34ef5218cf27dea3ce16a3a9bdeee037b7a84f5e" caused "not a directory"

Hello,

How does you docker-compose.yml look like? Are you using the original paths or have you changed them?

Edu.

Just got the latest pull and didn't change anything in the yml or any other files. Ran under "sudo" mode thats all. Here is my command: sudo docker-compose up -d

Have you created the folders /opt/jenkins, /opt/postgres and /opt/gitlab ?

And, by the way, what beta build of version 1.12 are you using?

Yes I did create (/opt/jenkins, /opt/postgres) because of previous issues. But I don't see /opt/gitlab in my Mac host? I am using the stable version and not the beta. Here is my version

Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: darwin/amd64

Server:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: linux/amd64

Have you added those directories to the docker's file sharing list?

docker-mac-gui-1

Yes I did. Have all except gitlab directory. I think the root cause is somewhere else. When I look up, I don't see a directory /var/lib/docker on my host. Anyway I will create the gitlab directory/share and see.

Interesting !!! When I created the subfolder gitlab under opt and tried to share in docker, got a error message saying "/opt/gitlab" is reserved for docker engine...

You should change the permission for those folders to your user, and by the way I think you should not use sudo.

Anyway got the same error, when I re-ran the same command "docker-compose up -d" no sudo.
(after creating the gitlab sub-folder)

I can't replicate your error. I had the same problem some days ago, but right now it is working as expected! :/

jenkins-1

What did you do to correct it? Though I have played with docker using virtual box before ( year back), never played on plain docker. Do u remember anything? How can I restart fresh install of the CI stack?

I just created folders within my own user folder: /Users/user/jenkins, etc and added /Users as shared filesystem to docker.

But finally I decided to make my own stack. Also because it seems that host mounted folders are not so portable according to docker documentation. If you want, have a look at it...

https://github.com/ethiclab/buildmachine

Otherwise, try the latest beta:

Version 1.12.1-beta26 (build: 12048)
d411b71fe748cb66845ccd3235ea5b60aaf71c72

I think they are playing a lot with this mac osx version right now.

Oh! I remember now how I fixed it.

#24

I just followed the advice given about subsituting '/usr/local/bin/docker' for '/usr/bin/docker'

23:   - /usr/bin/docker:/usr/bin/docker

because if you notice, the error is the same but it's for some reason shown in a different way.

Now I get a different error. Mount denied: /usr/bin/jenkin/
I think it is part of my new mac OS El Capiton OS. Here is the explanation..http://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really?newreg=068dc403fea74a3eb1e434b955924023

Can I mount to /Users?
/Users/bin/docker::/usr/bin/docker

/usr/bin/jenkin ? I think it is a typo. Could you please copy and paste your docker-compose.yml?

Here is my modified docker-compose.yml.
jenkins:
build: ./jenkins
ports:
- "18080:8080"
networks:
- prodnetwork
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/jenkin/docker:/usr/bin/docker
- /opt/jenkins/:/var/lib/jenkins/

I am getting this error:
ERROR: for jenkins Cannot start service jenkins: Mounts denied:
The path /usr/bin/jenkin/docker
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.

I am not able to "file share" /usr folder in docker preference because of my OS version ( i guess)..

there is a typo:

you should use:

 - /usr/bin/docker:/usr/bin/docker

and not:

 - /usr/bin/jenkin/docker:/usr/bin/docker

it does not make any sense.

My fault. When specified
/usr/local/bin/docker:/usr/bin/docker

correctly, I didn't any error. Finally !!. Lets see if all the URLs are working

Thanks for all your help,
-Sudharsan.

I was able to get all the URLs working. Thanks a lot and I can play with it more now. One last thing. How can I shutdown all the containers and bring it back?

well,

you can issue the following command:

docker-compose down

to restart just run again

docker-compose up -d

volumes are persistent.

Hello,

Please close this issue. I think you can since you opened it.

Thanks.

Had the same issue on my Mac - and below is how i resolved it.

After hours of googling and almost to the point of wanting to throw my Mac through the window the following worked for me .

I created a new folder ( mkdir name of folder and then open your Docker -> Preferences -> File Sharing and add the newly created directory - locate in the pc and add it in.

After that the Docker will restart and then viola!!!

PS - the error message always have the folder name it requires to proceed with the mount.
ERROR: for 'name' Cannot start service 'name': b'Mounts denied: \r\nThe path /certs\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'

Notice the following line - \r\nThe path /certs\r\nis not certs in this case is the folder thats being looked for - in your terminal you can do the following ( mkdir certs - certs being any folder name being required )

certs

please can you explain more in detail!!!!
@TalentBE
Thanks