Truncated files - Can not compile OpenSSL on mounted volume

Expected behavior

Able to mount a volume inside a container and compile OpenSSL

Actual behavior

Compilation halts with undefined references - suspect file system driver

Information

Docker for Mac: version: mac-v1.12.0-beta17
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160706-083054.tar.gz
[OK] docker-cli
[OK] app
[OK] menubar
[OK] virtualization
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

DockerFile:

FROM ubuntu:16.04
MAINTAINER Dan Cook

VOLUME /work

RUN apt-get update && apt-get install -y build-essential perl wget bison flex && \
wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz

Steps to reproduce the behavior

  • Create Image “docker build -t openssl .”
  • Create a container mounting the “work” directory to the local filesystem and compile
$ docker run -it --rm -v ~/openssl-build:/work openssl /bin/bash
root@46c0f702ac6a:/# tar -C work -xf openssl-1.0.2h.tar.gz
root@46c0f702ac6a:/# cd work/openssl-1.0.2h
root@46c0f702ac6a:/work/openssl-1.0.2h# ./config -fPIC shared no-idea no-rc5 --prefix=/work/dist
.... snip ....
md2test.c => dummytest.c
rc5test.c => dummytest.c
jpaketest.c => dummytest.c
make[1]: Leaving directory '/work/openssl-1.0.2h/test'

Configured for linux-x86_64.
Because of configuration changes, you MUST do the following before building

make depend
  • Compile and wait:
root@46c0f702ac6a:/work/openssl-1.0.2h# make depend && make && make install
  • Error observed:
... snip ...
collect2: error: ld returned 1 exit status
../Makefile.shared:171: recipe for target 'link_app.gnu' failed
make[2]: *** [link_app.gnu] Error 1
make[2]: Leaving directory '/work/openssl-1.0.2h/apps'
Makefile:156: recipe for target 'openssl' failed
make[1]: *** [openssl] Error 2
make[1]: Leaving directory '/work/openssl-1.0.2h/apps'
Makefile:290: recipe for target 'build_apps' failed
make: *** [build_apps] Error 1

It seems the files are truncated. Scanning the output I see errors like this printed:

ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM   -c -o ts_asn1.o ts_asn1.c
ar  r ../../libcrypto.a ts_err.o ts_req_utils.o ts_req_print.o ts_rsp_utils.o ts_rsp_print.o ts_rsp_sign.o ts_rsp_verify.o ts_verify_ctx.o ts_lib.o ts_conf.o ts_asn1.o
/usr/bin/ranlib ../../libcrypto.a || echo Never mind.
/usr/bin/ranlib: ../../libcrypto.a: File truncated
Never mind.

Hi Dan,

I believed we’ve fixed this issue in Beta 21/1.12 as several low-level file system caching issues were identified and fixed. I can no longer reproduce the issue on these versions.

We’d be interested to hear if you still experience this issue. We’ve recently transitioned to GitHub-based issue tracking so if you continue to experience this issue (or others) please report it to https://github.com/docker/for-mac/issues.

Thanks for participating in the Docker for Mac Beta!

Best regards,

David