Search code examples
macosbashradixdocker

Docker base image running slowly Mac OS X


So I have docker set up on OS X by using boot2docker. I have everything working, however, when I run docker run -i -t base /bin/bash it works, the prompt shows up... but it is EXTREMELY slow. By slow, I mean that if I would type one character, it takes about 30 seconds to a minute for that character to show up on the screen. I checked my Activity Monitor to make sure my system wasn't low on memory but that was not the case. It was showing around 85% of idle memory while this process was running. I was curious to see if anyone else on OS X was experiencing issues like this. Any input would be appreciated.


Solution

  • I've experienced the very same problem and as Julian already stated, it's a known issue. But, there is one post in that issue-thread that worked for me (well, at least an adapted version of it).

    ./boot2docker stop           # stop a currently running deamon-instance
    ./boot2docker delete         # remove the vm
    rm -rf boot2docker.iso       # in my case I had a (very old) iso-image
    

    At this stage any new attempt to re-initialize the boot2docker-vm failed for me. So I was forced to re-install boot2docker itself (and as it turned out I had a very old version). You can do this via Homebrew or with the new installer (whereas, the solution demonstrated in the docker-docu doesn't work anymore). In any case, don't forget to set the DOCKER_HOST variable correct as explained in the documentation:

    export DOCKER_HOST=tcp://127.0.0.1:4243
    

    After re-installing boot2docker the following commands should work again:

    ./boot2docker init           # fetches a brand new vm image and initializes
    ./boot2docker up             # now we're back in business
    

    That did it for me - now the performance is as expected

     docker run -i -t --rm dockerfile/ubuntu /bin/bash
    

    gives me an (almost) instant bash-prompt.