Docker Community Forums

Share and learn in the Docker community.

Modifying file in mounted folder crashes Docker VM

(A2daj) #1

Expected behavior

File is modified with sed

Actual behavior

Mac Docker VM crashes


  • the output of:
    • pinata diagnose -u on OSX
S X: version 10.11.4 (build: 15E65) version v1.10.3-beta5
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      lofs
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160330-211600.tar.gz.
Upload to bugsnag failed:
2016/03/30 21:16:01 notifying bugsnag: unknown error
2016/03/30 21:16:04 bugsnag.Notify: bugsnag/payload.deliver: Got HTTP 400 Bad Request
  • host distribution and version OSX 10.11.4,

Steps to reproduce the behavior

make a script out of this and execute it


mkdir files

touch files/template
cat > files/template << EOT

touch files/

cat > files/ << EOF

cp template testfile

echo replacing TEXT_BLOB1
sed -i "s~\\\${TEXT_BLOB1}~Hello~g" testfile

echo replacing TEXT_BLOB2
sed -i "s~\\\${TEXT_BLOB2}~again~g" testfile

echo replacing TEXT_BLOB3
sed -i "s~\\\${TEXT_BLOB3}~world~g" testfile


chmod 755 files/

cat > Dockerfile << EOD
FROM centos:centos7

RUN mkdir /opt/sedbugtest

COPY files /opt/sedbugtest/files
RUN chmod +x /opt/sedbugtest/files/

ENV PATH \$PATH:/opt/sedbugtest/files

WORKDIR /opt/sedbugtest/files

CMD [""]


docker build --tag="sedtestbug" .

docker run -it --name sedtest \
-v $PWD/files:/opt/sedbugtest/files \

docker rm sedtest

(David Sheets) #2

Thanks for the excellent reproduction script!

I can confirm that this script fails due to a defect in the shared file system. It is similar to an issue we were already tracking and slated to be fixed in Beta 6 but it appears to have further-reaching consequences than we expected. I don’t see VM crash behavior but it definitely interferes with normal function of the Docker daemon. I have escalated the issue and we are now using your script as a test case.

Thanks for the thorough report and your participation in the Docker for Mac Beta!

(David Sheets) #3

There were two bugs interacting badly here – an error handling bug that you correctly found crashed the VM and a permissions semantics bug (sed likes to change the permissions of mode 0 files). Both have been fixed and tests put in place to prevent regression. The fixes will be in Beta 6 on Tuesday. Thanks!

(A2daj) #4

Awesome! I actually have a more advanced case that would usually wipe out the existing containers (images were safe). It’s doing something similar to above but more complex. The use case is basically a container with a template of a properties file. I’m then using sed to replace properties with environment variables passed in or default values accordingly. My stripped down version above didn’t seem to consistently wipe the containers. I’ll check to see if the next beta also fixes the containers getting wiped, too.