marcelbirkner / docker-ci-tool-stack

Docker Infrastructure via docker-compose (Jenkins, SonarQube, Nexus, GitLab, Selenium Grid)
MIT License
815 stars 599 forks source link

Issue with Native docker on Mac #26

Closed sudhar99 closed 8 years ago

sudhar99 commented 8 years ago

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"

ethiclab commented 8 years ago

Hello,

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

Edu.

sudhar99 commented 8 years ago

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

ethiclab commented 8 years ago

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

ethiclab commented 8 years ago

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

sudhar99 commented 8 years ago

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

ethiclab commented 8 years ago

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

docker-mac-gui-1
sudhar99 commented 8 years ago

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.

sudhar99 commented 8 years ago

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...

ethiclab commented 8 years ago

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

sudhar99 commented 8 years ago

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

ethiclab commented 8 years ago

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

jenkins-1

sudhar99 commented 8 years ago

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?

ethiclab commented 8 years ago

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

ethiclab commented 8 years ago

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.

ethiclab commented 8 years ago

Oh! I remember now how I fixed it.

https://github.com/marcelbirkner/docker-ci-tool-stack/issues/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.

sudhar99 commented 8 years ago

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

ethiclab commented 8 years ago

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

sudhar99 commented 8 years ago

Here is my modified docker-compose.yml. jenkins: build: ./jenkins ports:

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)..

ethiclab commented 8 years ago

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.

sudhar99 commented 8 years ago

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.

sudhar99 commented 8 years ago

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?

ethiclab commented 8 years ago

well,

you can issue the following command:

docker-compose down

to restart just run again

docker-compose up -d

volumes are persistent.

ethiclab commented 8 years ago

Hello,

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

Thanks.

TalentBE commented 6 years ago

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 )

87abhii commented 5 years ago

certs

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