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
Linux tests using Docker on Mac #5891
Comments
@micknudsen not sure I've seen this error before. Are you able to run docker run outside the context of simulate-travis.py? That is, are you able to do this without errors:
|
Yup. Everything works as expected:
|
Sorry, without being able to reproduce locally it's tough to troubleshoot. Have you tried things suggested here: docker-archive/toolbox#453? Is docker fully up-to-date? @bioconda/osx, any advice? |
@micknudsen Sorry about your troubles. The support for docker on OSX is new. I guess I'm to blame for your troubles... Could you try @daler I'll write a patch that uses |
@epruesse thanks, that would be great. |
@epruesse Thanks for your suggestions. Unfortunately, they don't fix my problem:
Regenerating certificates does not help either. The solution may be in the thread linked to by @daler, but I am a little short on time right now. I will be able to do more troubleshooting in a few days. Maybe the discussion should continue in that thread? |
@micknudsen Yes, that does look like it's a docker, rather than a Bioconda issue. You could try connecting to the host/port listed using Also check @daler Let's keep this open for now so I have a reminder to make |
ping @epruesse |
I agree the documentation is too terse right now. Having realised I needed Docker to run the mulled test framework locally - and we don't have Docker on our cluster - I am trying this on macOS:
Docker is running (little icon in my top right menu bar), diagnostics,
Following @daler's suggestion to confirm Docker does work:
Then following docker-archive/toolbox#453 (comment)
That seemed to be a key step -
But anyway, the documentation or script seems to need to handle a fresh install with no default Docker image setup. |
Thanks for the diagnostics @peterjc! Since setting the default is a one-time operation, would it be sufficient to add details to the setup docs? Or should we do the try/except in simulate-travis.py? If the latter, do you know if As for that last error, I wonder if it MacOS docker is unable to map single files over to the container. If so, simulate-travis.py can put the bash script into a temp dir and map that whole dir over. I don't have a mac available for testing, so I'm flying blind here . . . I'm happy to write some code, but it will be untested and someone would have to see if it works on mac. |
Based on the command line help, it appears
This seems to work - first to remove my old default:
Then,
I suspect it would be better to document this prominently over trying to automate this. As to the last error, I don't know enough about Docker and Docker-on-macos to know where to start investigating mapping the bash script to the container. But I can try test commands for you, or a branch if needed. |
For anyone else following this, as per https://github.com/bioconda/bioconda-utils/blob/master/docs/source/troubleshooting.rst its the
And,
Perhaps this really doesn't want individual files via |
Rather than mapping the file
I had tried editing '-v', '{0}:/opt/build_script.bash'.format(build_script), to: '-v', '{0}:/opt'.format(os.path.dirname(build_script)), But perhaps this progress - does this confirm mapping a single file is a problem? |
Good, I was starting to explore along those lines last night - nice to have your confirmation: --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -435,7 +435,8 @@ class RecipeBuilder(object):
raise ValueError('build_args must be str')
self.conda_build_args = build_args
- # Write build script to tempfile
+ # Write build script to temp dir
+ # (in its own directory so we can mount it with -v on macOS docker)
build_dir = os.path.realpath(tempfile.mkdtemp())
with open(os.path.join(build_dir, 'build_script.bash'), 'w') as fout:
fout.write(self.build_script_template.format(
@@ -457,12 +458,12 @@ class RecipeBuilder(object):
'docker', 'run',
'--net', 'host',
'--rm',
- '-v', '{0}:/opt/build_script.bash'.format(build_script),
+ '-v', '{0}:/opt/build'.format(build_dir),
'-v', '{0}:{1}'.format(self.pkg_dir, self.container_staging),
'-v', '{0}:{1}'.format(recipe_dir, self.container_recipe),
] + env_list + [
self.tag,
- '/bin/bash', '/opt/build_script.bash',
+ '/bin/bash', '/opt/build/build_script.bash',
]
logger.debug('DOCKER: cmd: %s', cmd) Sadly this still fails,
Might this be a permissions problem with what Docker can see outside of the user's home folder? |
Putting the local copy of --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -435,8 +435,8 @@ class RecipeBuilder(object):
raise ValueError('build_args must be str')
self.conda_build_args = build_args
- # Write build script to tempfile
- build_dir = os.path.realpath(tempfile.mkdtemp())
+ # Write build script, under $HOME for permissions on macOS
+ build_dir = os.path.realpath(tempfile.mkdtemp(dir=os.environ["HOME"]))
with open(os.path.join(build_dir, 'build_script.bash'), 'w') as fout:
fout.write(self.build_script_template.format(
self=self, pkg=pkg, arch='noarch' if noarch else 'linux-64'))
@@ -457,12 +457,12 @@ class RecipeBuilder(object):
'docker', 'run',
'--net', 'host',
'--rm',
- '-v', '{0}:/opt/build_script.bash'.format(build_script),
+ '-v', '{0}:/opt/build'.format(build_dir),
'-v', '{0}:{1}'.format(self.pkg_dir, self.container_staging),
'-v', '{0}:{1}'.format(recipe_dir, self.container_recipe),
] + env_list + [
self.tag,
- '/bin/bash', '/opt/build_script.bash',
+ '/bin/bash', '/opt/build/build_script.bash',
]
logger.debug('DOCKER: cmd: %s', cmd) And:
|
OK, I'm pretty sure the failure to run --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -435,8 +435,9 @@ class RecipeBuilder(object):
raise ValueError('build_args must be str')
self.conda_build_args = build_args
- # Write build script to tempfile
- build_dir = os.path.realpath(tempfile.mkdtemp())
+ # Write build script, under recipe_dir for permissions on macOS
+ build_dir = os.path.join(recipe_dir, 'tmp')
+ os.mkdir(build_dir)
with open(os.path.join(build_dir, 'build_script.bash'), 'w') as fout:
fout.write(self.build_script_template.format(
self=self, pkg=pkg, arch='noarch' if noarch else 'linux-64'))
@@ -457,12 +458,11 @@ class RecipeBuilder(object):
'docker', 'run',
'--net', 'host',
'--rm',
- '-v', '{0}:/opt/build_script.bash'.format(build_script),
'-v', '{0}:{1}'.format(self.pkg_dir, self.container_staging),
'-v', '{0}:{1}'.format(recipe_dir, self.container_recipe),
] + env_list + [
self.tag,
- '/bin/bash', '/opt/build_script.bash',
+ '/bin/bash', os.path.join(self.container_recipe, 'tmp', 'build_script.bash'),
]
logger.debug('DOCKER: cmd: %s', cmd) However, it brings us to another permissions failure:
Any ideas? |
Thanks @peterjc for trying these and reporting back. @epruesse, you were working with docker on mac, can you offer any insight? Seems to be differences in allowed permissions between mac and linux versions of docker. @peterjc only other thing I can think of at the moment is modifying the Dockerfile to ensure permissions on |
@daler a top level permissions change for |
In the
In general, that would be the place to add top-level changes for troubleshooting. The template is filled in with |
My initial guess, --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -134,6 +134,7 @@ DOCKERFILE_TEMPLATE = \
"""
FROM bioconda/bioconda-utils-build-env
{self.proxies}
+chmod ugo+rw {self.container_staging}
""" gave:
Tried: --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -134,6 +134,7 @@ DOCKERFILE_TEMPLATE = \
"""
FROM bioconda/bioconda-utils-build-env
{self.proxies}
+RUN chmod ugo+rw {self.container_staging}
""" gave:
This gets further (will update with output shortly): --- a/bioconda_utils/docker_utils.py
+++ b/bioconda_utils/docker_utils.py
@@ -134,6 +134,7 @@ DOCKERFILE_TEMPLATE = \
"""
FROM bioconda/bioconda-utils-build-env
{self.proxies}
+RUN chmod ugo+rw /opt
""" Update - that broke with:
|
Some background on what's going on here: Docker needs OS support which macOS doesn't have, so on macOS we use docker-machine, which offers a set of drivers. The default configuration on macOS installs VirtualBox as a driver, which runs a Linux, in which the containers are then run. So we have two layers involved. And that means two layers for file system mappings as well. The mappings given with By default, the I thought I had this fixed at some point somewhere by simply setting the There is one more caveat surrounding UIDs and permissions of files. Docker in the Linux guest runs AFAIK as UID 1000. I'm not sure how that whole mess is handled, but it seems prone to problems as well. |
Thanks @epruesse - this is more complicated than I appreciated. |
Hi,
I am trying to test recipes locally using
simulate-travis.py
on my Mac. I have Docker installed and running, but I always get the following error:The Bioconda documentation just states that Docker should be installed. Does it require additional setup?
The text was updated successfully, but these errors were encountered: