Comments (33)
I have the same problem on latest Mac OSX.
swarm-1
swarm-2
swarm-3
>> The swarm cluster is up and running
$ eval $(dm env swarm-1)
$ docker service create --name jenkins \
> -p 8082:8080 \
> -p 5000:5000 \
> -e JENKINS_OPTS="--prefix=/jenkins" \
> --mount "type=bind,source=$PWD/docker/jenkins,target=/var/jenkins_home" \
> --reserve-memory 300m \
> jenkins:2.7.4-alpine
ellu03hw1lg1lhhpxvgd9un49
$ docker service ps jenkins
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
q2tdfoc0rf16 jenkins.1 jenkins:2.7.4-alpine swarm-1 Running Preparing 12 seconds ago
$ docker service ps jenkins
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
tkj0r2wnttui jenkins.1 jenkins:2.7.4-alpine swarm-1 Ready Rejected less than a second ago "invalid mount config for type…"
ze6kjc76dbls \_ jenkins.1 jenkins:2.7.4-alpine swarm-1 Shutdown Rejected 5 seconds ago "invalid mount config for type…"
tytvb42fzy0l \_ jenkins.1 jenkins:2.7.4-alpine swarm-3 Shutdown Rejected 10 seconds ago "invalid mount config for type…"
tyq0ea0bauuy \_ jenkins.1 jenkins:2.7.4-alpine swarm-3 Shutdown Rejected 15 seconds ago "invalid mount config for type…"
v4qj386qlzkk \_ jenkins.1 jenkins:2.7.4-alpine swarm-3 Shutdown Rejected 20 seconds ago "invalid mount config for type…"
ijpdr4ztrhud \_ jenkins.1 jenkins:2.7.4-alpine swarm-3 Shutdown Rejected 25 seconds ago "invalid mount config for type…"
Can't seem to find the docker/jenkins
folder used as source?
$PWD/docker/jenkins
-bash: /Users/kristianmandrup/repos/docker-projs/go-demo/cloud-provisioning/docker/jenkins: No such file or directory
$ $PWD/docker/jenkins
-bash: /Users/kristianmandrup/repos/docker-projs/go-demo/docker/jenkins: No such file or directory
Any idea what I could be missing?
from cloud-provisioning.
The command you posted should not be necessary in most cases. Which OS are you using (Windows, OSX, Linux)?
from cloud-provisioning.
I'm using Ubuntu 16.04. I just deleted the command I posted in my reply, because I couldn't replicate the result. For posterity, it was docker-machine ssh swarm-1 "mkdir -p docker/jenkins"
.
Version info:
jw@js-MS-001:~$ docker version
Client:
Version: 1.12.3
API version: 1.25
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 22:01:48 2016
OS/Arch: linux/amd64
Server:
Version: 1.13.0-rc2
API version: 1.25
Go version: go1.7.3
Git commit: 1f9b3ef
Built: Wed Nov 23 17:40:58 2016
OS/Arch: linux/amd64
from cloud-provisioning.
Docker Machine mounts user's directory from the host inside the VMs it creates. That allows us to share the files. However, that feature does not work in Docker Machine running on Linux. The easiest workaround is, for now, to remove the --mount
argument. Later on, when we reach persistent storage, you'll see how to mount volumes more effectively.
The good news is that the problem will be fixed soon. Please see the issue #1376 for the discussion. Once the pull request #2122 is merged, you will be able to use automatic mounting on Linux.
from cloud-provisioning.
Awesome! Thank you so so much. Love the books.
from cloud-provisioning.
Seems that docker/machine#2122 is merged. Can you try it out and let me know if it works?
from cloud-provisioning.
I was able to work around this by creating a host mount in VirtualBox, auto-mounting it to "jenkins-agent "-labelled nodes at the time of swarm creation and finally mounting to Compose-created containers with the usual volume mount syntax.
I'll take the more direct approach when I find some free time and report back.
from cloud-provisioning.
I have the same issue as above and I'm unable to mount the drive. I even skipped the same step in the previous chapter.
I'm using Windows 10 and Docker ToolBox.
I have attached my screen grab and also the command I ran
docker service create --name jenkins -p 8082:8080 -p 50000:50000 -e JENKINS_OPTS="--prefix=/jenkins" --mount "type=bind,source=/c/Users/rames/cloud-provisioning/docker/jenkins,target=/var/jenkins_home" --reserve-memory 300m jenkins:2.7.4-alpine
from cloud-provisioning.
@rpchili Can you create Jenkins from a VM? That would be only a workaround until I figure out the cause of the problem.
from cloud-provisioning.
@vfarcic So, create jenkins from a VM and then follow the book??
from cloud-provisioning.
@rpchili Yes. That should (probably) avoid any problems cause by Windows.
from cloud-provisioning.
@rpchili Actually, now when I look at it again, running it from a VM will probably not fix the problem. I'll try to replicate it tomorrow and get back to you. If I do not manage to reproduce the same situation, I'll ask you for a chat session with screen sharing so that we can try to solve it together. Would that be OK?
from cloud-provisioning.
That would be extremely helpful. Thank You.
from cloud-provisioning.
@vfarcic Any luck with the issue? I cannot get past it. I'm Sorry to bother you again.
from cloud-provisioning.
@rpchili First of all, sorry for the late reply.
I managed to reproduce the problem and found the fix. Actually, the fix is in the book if you have a version from a few weeks ago (or newer). The comment is directly above the command that creates the service.
A note to Windows users
Git Bash has a habit of altering file system paths. To stop this, execute the following before running the code block.
export MSYS_NO_PATHCONV=1
Can you please remove the service, export the env. var and create the service again?
Please let me know if that fixed the problem.
Also, it would be useful to know where you both the book (LeanPub.com or Amazon.com) and whether it's paperback or eBook. In case it's paperback, please join http://slack.devops20toolkit.com and contact me on the private channel and I'll send you the latest eBook version (you'll also receive updates whenever I make them).
from cloud-provisioning.
Thank you for your response. Unfortunately I still have the same issue
Do you think I should ssh into swarm-1 machine and mount the drive first as you suggested in the previous chapter?
from cloud-provisioning.
Can you join http://slack.devops20toolkit.com/ and ping me there? We can take a look at it together. Windows is not one of my strong skills but I'm sure that we'll find a solution together.
from cloud-provisioning.
Can I join in 30min? Will you be available?
from cloud-provisioning.
I will :)
from cloud-provisioning.
Thank You. See you soon
from cloud-provisioning.
Using export MSYS_NO_PATHCONV=1
fixes mounting on Windows.
The problem @rpchili experienced is different than the original issue so I'm closing this ticket.
from cloud-provisioning.
Please reopen if you experience a problem with mounting a volume on Windows after using the export
command
from cloud-provisioning.
I think this might be why: moby/moby#25912 (comment)
bind
: Paths on the host that get mounted into the container. Paths must exist prior to creating the container. If you want docker to create a path for you, then use a volume
.
from cloud-provisioning.
I thought I had created the dir via mkdir -p
but somehow missed it. Make sure the folder is there.
$ $PWD/docker/jenkins
go-demo/cloud-provisioning/docker/jenkins: is a directory
Then it will run:
xkncxntyy82b jenkins.1 jenkins:2.7.4-alpine swarm-2 Running Running about a minute ago
and open "http://$(dm ip swarm-1):8082/jenkins"
will open up jenkins Getting started/Unlock screen:
Unlock Jenkins
To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:
/var/jenkins_home/secrets/initialAdminPassword
Where password should be found in: cat docker/jenkins/secrets/initialAdminPassword
(relative to /cloud-provisioning root)
Clicking install suggested plugins
I get: An error occurred during installation: No such plugin: cloudbees-folder
Ooops! Tricky...
Best to remove all swarm nodes and start over with the folders in place
from cloud-provisioning.
Yup, a fresh restart of the swarm and the jenkins server worked!
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
emf6tqho5xx6 jenkins.1 jenkins:2.7.4-alpine swarm-1 Running Preparing 20 seconds ago
Now use the new generated initial password and the plugins should install just fine :)
from cloud-provisioning.
A fresh restart of the whole swarm is necessary? How does one restart an entire swarm efficiently?
from cloud-provisioning.
Try the gists The jenkins gist worked for me.
Try docker service rm
or using a for loop to remove all nodes in a swarm, sth like:
# remove nodes 1..3
for i in 1 2 3; do
docker-machine rm -f swarm-$i
docker-machine rm -f swarm-test-$i
done
Not sure if there is a better way?
from cloud-provisioning.
(Windows) I am following along in the book and could not get the mount to work under PowerShell or Git bash. May be related to the comments above regarding the directory had to exist. I was using command on page 80...
docker service create --name registry -p 5000:5000 --reserve-memory 100m --mount "type=bind,source=/var,target=/var/lib/registry" registry:2.5.0
and when running 'docker service ps registry', I would get error message "invalid mount config for type…" for the service.
If I specified a known directory in the docker machine, it would work..
$docker service create --name registry -p 5000:5000 --reserve-memory 100m --mount "type=bind,source=/var,target=/var/lib/registry" registry:2.5.0
Is the problem that the $PWD is being evaluated in the context of my local GitBash, but then attempted to be applied to my docker machine, where the directory does not exist?
from cloud-provisioning.
Docker Machine mounts your local user directory into VM. If the commands you're running are inside your user dir (or sub-dir), it should work. Can you please let me know the path where you cloned the code?
from cloud-provisioning.
For what it's worth, it may be because the docker image is still downloading. If you ssh into the node:
docker-machine ssh <node>
then:
tail -f /var/log/docker.log
it may provide a clue. In my case I eventually get
level=error msg="fatal task error" error="invalid mount config for type \"bind\": bind source path does not exist" module="node/agent/taskmanager"
after the downloads have finished.
from cloud-provisioning.
How did it go @batwicket ? Did it pull the image?
from cloud-provisioning.
from cloud-provisioning.
That's great news. I'm happy it worked out.
from cloud-provisioning.
Related Issues (10)
- Prometheus targets problem HOT 7
- swarm creation: VIRTUALBOX_SHARE_FOLDER issue on Windows HOT 3
- update swarm deploy to support Terraform v0.9.1 HOT 1
- DevOps2.1: Automating Continuous Deployment Flow WithJenkins HOT 10
- dm-test-swarm.sh doesn't work if `--virtualbox-memory 512` is set HOT 1
- DevOpts2.1: Using Packer To Create Amazon Machine Images (AMIs) HOT 2
- AWS related Packer Scripts failing to provision AMIs HOT 1
- terraform error on digitalocean_droplet example HOT 2
- Add Elastic IP configuration to terraform HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloud-provisioning.