-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Cannot build useful docker images on OS X (darwin) #16696
Comments
you would need to perform the build from |
Thanks for replying. I currently use a similar work-around. However, the bug still stands:
|
i would actually expect that |
@lethalman should we add such assert statement? |
Docker have done a lot of work to make it easy to build & run docker images on OS X. It would be a shame to have to throw all that away to use Nix. |
I don't see why it shouldn't work, docker is not even involved here. |
@garbas there's no reason for a specific assertion. If a package is not supported on darwin there's little I can do, and I don't want to add extra friendly magic error messages. It's quite clear there, linux-pam is not supported. Yet, it's perfectly possible to build images on OS X without involving PAM stuff, pretty limited but possible. @jml The main difference between our dockerTools and docker itself is that with dockerTools we take advantage of Nix build artifacts outside of the container. That means linux-pam is supposed to be available on OS X, which isn't the case obviously. While Docker builds its stuff within the container. |
To be clear, might be fixable by using shadow without PAM on OS X, and that might work for most cases. |
OK, I think I understand now. dockerTools re-implements Even if the PAM thing got sorted out, dockerTools would still not be useful on OS X, because it would produce darwin binaries that couldn't run inside a Linux container. I still want to use Nix expressions to build Docker images while running on OS X. I still think that's a laudable goal. Would it be possible to make something that provides a similar interface to dockerTools, but uses the |
I would like to second @jml's desire to be able to use Nix expressions to build Docker images while running on OS X. |
@jml @mightybyte i dont see building docker images from other docker images as a work around, but exactly what docker cli is doing. |
It's a significantly worse user experience than the Docker CLI, which does all of that for you automatically. |
I wouldn't say I'd like to make something like that easier to use for OSX users, but it should get you reasonably transparent cross-builds like that today. |
Using a remote builder as suggested by @copumpkin above gets closer, but not to the point of successful builds. After configuring an appropriate builder (either with @LnL7's tools or
...thus fails with:
(...as also brought up on Unix & Linux StackExchange at https://unix.stackexchange.com/questions/470420/bash-cannot-execute-binary-file-during-nix-dockertools-cross-build-from-macos). |
Closing for now as we have https://github.com/nix-community/linuxkit-nix which is doing the equivalent of what Docker does. |
Has anyone resolved the
issue that @charles-dyfis-net mentioned? I still can't build docker images, even with linuxkit-nix. |
This answer helped for me. Instead of using
For example
|
Issue description
I am trying to build docker images using nix on my Macbook Pro, running Darwin. When I try to do so, nix tries to build
linux-pam
on my Darwin laptop, rather than on the docker-machine VM that I normally use for Docker. This fails, and so I can't build docker images.Normally, I use the docker-machine VM for building images. The
docker
command on OS X works transparently with that VM, provided certain environment variables are set. I would have thus expected Nix to use the VM for building images.I tried to find documentation on how to build docker images on OS X via the docker-machine VM, but couldn't find anything.
Steps to reproduce
Using the
redis-small.nix
example on @lethalman's blog, repeated below:And then running
nix-build
...When I add
allowBroken
, I get the following:Technical details
16.09pre83147.df89584
The text was updated successfully, but these errors were encountered: