So I have a Jenkins master container ali_jenkins_m setup which I spin up using a data volume container ali_jenkins_data for storing the Jenkins data.
docker run -p 8080:8080 -p 50000:50000 --name ali_jenknins_master --volumes-from ali_jenkins_data -d ali_jenkins_m
I have setup a TFS plugin and mapped one of our TFS branches to pull the code into Jenkins and build. Everything worked well until I removed my jenkins master container ali_jenkins_m and then recreated it. When recreating I still used the data volume container ali_jenkins_data. All my data has persisted as expected but I am running into issues building from TFS in Jenkins.
The error I get is:
Creating workspace 'HUDSON-MCA Continuous Development Build-MASTER' owned by 'DOMAIN\tfsbuild'...
FATAL: com.microsoft.tfs.core.exceptions.TECoreException: The workspace HUDSON-Development Build-MASTER;tfsbuild already exists on computer **a4d8cdb6981d**.
The a4d8cdb6981d is the container ID of the ali_jenkins_m that I removed. My new conatiner ali_jenkins_m has a new container id. I looked around everywhere on the mount to figure out what needs to be changed to make this work.
Any pointers will be appreciated.
So, this was a problem with TFS and nothing to do with Docker or Jenkins. I solved this problem by running this command.
Another way, we solved this problem was to use a -h option to specify a hostname when running the docker run command. So from above my docker run command now looks like this:
This was a better way to do it. Now we dont need to run the tf workspace /delete command every time I recreated the container