emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

Can't build a docker image. #HelpNeeded #72

Closed My- closed 5 years ago

My- commented 5 years ago

Hi. First I should say I'm very new to docker. I'm trying to build a docker image using nightly Rust (planning to use Rocket). But build fails with error (two last lines):

....
making all in tools...
make[1]: Entering directory '/tmp/openssl-1.0.2o/tools'
make[1]: Nothing to be done for 'all'.

make[1]: Leaving directory '/tmp/openssl-1.0.2o/tools'
sudo: /etc/sudoers.d/nopasswd is world writable
sudo: no tty present and no askpass program specifie
....

The only change I did in Dockerfile is in line 6 changed to ARG TOOLCHAIN=nightly

To be honest I can't even build the original file... so I guess it's related to my lack of docker knowledge. I spend lots of time searching for a solution but never got any progress.

My system:

uname -a
Linux myMint 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

docker -v
Docker version 18.09.2, build 6247962
emk commented 5 years ago

Sorry to hear about your difficulties. Try using the pre-built nightly images off Docker Hub. In your project's Dockerfile, replace the FROM line with one of the following:

FROM ekidd/rust-musl-builder:nightly-2019-04-17
FROM ekidd/rust-musl-builder:nightly-2019-04-12

I'm currently working on a Rocket project using nightly-2019-04-12, and it works fine. Also see the examples/using-diesel directory, and the hooks/test script in rust-musl-builder. That should show you some examples of working projects.

If all that fails with similar errors, try using a fresh check out rust-musl-docker on a Linux or Mac, and running:

./test-image

If that fails, please post the error.

Good luck!

emk commented 5 years ago

OK, I've confirmed that ./test-image works correctly on my machine.

My- commented 5 years ago

Thanks for the help. You helped to solve the problem I had. I used your prebuild image.

Probably my docker experience to noobish, I still can figure out how could I check for your nightly Rust builds. It would be nice if this information would be easy to find at Docker Hub.

Now I have other errors: Rocket complains about abstinence of the secret_key, as well arm (rPI) build fails. But as it not related to the original issue: I close this issue.