Simplifying Docker on OS X
blog.andyet.com
blog.andyet.com
Easier to use, more reliable and some nice features like the OPs .docker DNS and NFS shares. The maintainer is very responsive and I recommend it to anyone who is struggling with docker on OSX.
The article sounds like a fun personal project, but I definitely don't see inconvenience on OSX being a justification.
If shell commands are too much to type then create aliases.
The VM's IP doesn't seem to change; add an entry in /etc/hosts mapping it to something like "docker-machine".
I don't understand the people in this thread complaining that OSX support is, e.g., "lackluster". The docker containers don't run on OSX so it's very nice that there's an OSX client that works perfectly as far as I can tell.
Haven't had any problems since, and it's been easier to get people started.
I'm excited to try out xhyve for virtualization, but even if you solve the virtualization problem there are still some real usability concerns around using Docker for development in even medium-sized teams. I gave a talk at PyGotham[2] about some of the benefits and issues of using Docker for dev at this point.
All told, this looks like it might be an attractive lightweight solution though if virtualization is your main problem now.
[1] http://dusty.gc.com/ [2] https://www.youtube.com/watch?v=pYLOuuR7HI0
If anyone's interested, I've created a list of steps involved in making it work on El Capitan: https://gist.github.com/pch/aa1c9c4ec8522a11193b
If you intend to use docker containers on osx as an isolated runtime, with all your "data" sync'd in realtime between your host and your container, then use linux.
Fswatch / Rsync / unison over NFS, ssh or cifs are hacks of a greater order than having to source an env script.
Out of curiosity, why would you need directional sync/unison?
If you forget your charger, there is serious range anxiety. Luckily, I've been running PC laptops for years and have gotten completely used to bringing my charger any time I take my laptop.
Years ago, when I started doing it, the battery life of Linux on Macbook was really terrible.
I only need a couple of hours of battery life for my mac at most, so that's fine for me at least.
if flash starts, i get less than half. (using archlinux on a mid-2012 mbp)
1. The fans don't automatically react to temperature without a background daemon (?!).
2. Multi-touch trackpad support is terrible. The default synaptic driver can't handle you resting your thumb on the bottom of the trackpad. The alternative driver doesn't support momentum scrolling (and is still a bit shit). At least palm detection has been solved; well done Linux, it only took you 10 years.
3. It cannot seem to handle using left Alt as a third-level activator (e.g. for # key on EU keyboards) at the same time as actually letting you /use/ your Alt key (e.g. for activating menus). I think I eventually solved this, but how hard should it be?!
4. As others have mentioned; battery life.
I was impressed that sleep, audio, wifi and display brightness all worked out of the box though. Progress, eh?
1. I currently don't have a problem with that (the fans/temperature management). In my seven years of running Ubuntu on Macbooks, I've run into that in the past, but it's been a while. 2. I've never been a 'full' OSX user, but I understand that they are doing a lot of very nifty things with the touch pad, not surprisingly. My experience with the touchpad under Ubuntu is generally not as good as under OSX. 3. Can't comment on this one 4. As described elsewhere.
For most people, I would not recommend running any Linux flavor on a Macbook. I am a 'UNIX guy' for decades now. Hell, I even run a minimalistic windows manager (http://www.6809.org.uk/evilwm/)
For me, the upsides outweigh the downsides. I'm pretty sure that's not the case for most people though.
I was also motivated by bringing on new team members who were on Windows rather than Macs. Vagrant works fine and transparently on both Mac and Windows, with the same commands. It's not necessary for everyone, but I was pleased that my best Mac solution also works just as well on Windows.
One of the benefits of doing this, I find, is that all the power-hungry stuff happens on the server, so I can have a really lightweight development machine (e.g. one of the 2015 Macbooks.)
In fact I put this horrible hack into my ~/.bash_profile (I wouldn't recommend doing this but, hey, it works.):
docker-machine start dev
eval "$(docker-machine env dev)"
But DLite appears to resolve a lot of this 'hackiness'.
This whole problem took me <5 mins to solve, and about 30s to solve each boot. I could quite easily start the VM on boot as well, but it's such a non problem for me that I don't even bother spending the 3 mins it'd take to set up.
And if you really need docker-lite- you do not need to write it in go, just do
Run that once (do sudo or any other crazy stuff):
``` echo $(docker-machine ip dev) local.docker >> /etc/hosts ```
Add that to `.bashrc`
``` eval $(docker-machine eval dev) ```
Apparently is a known issue https://github.com/mist64/xhyve/issues/84 ; it might have to do with Hypervisor.framework
can you share a link ? thanks
I am all in on docker development because I am all in on using images and containers in production via ECS. Getting a laptop and AWS talking the same abstraction is the future.
I too suffer from problems with Docker Machine and virtual box on OS X. Frequently I find myself debugging these subsystems. It's been ok because the worst case to get back to a good state is uninstall, reboot and reinstall. Annoying but passable b
I have also experimented with xhyve and it looks extremely promising but does need some new tools to make it a turnkey docker dev environment.
From my survey of this technique and the tools we need more time, energy and cooperation to get there.
Thank you and everyone else for your efforts!
You can already do this with Vagrant and VirtualBox. Docker is just additional abstraction.
----
alias dm="docker-machine"
alias dc="docker-compose"
alias denv='function __denv() { eval "$(dm env $@)"; unset -f __denv; }; __denv'
----
dm create --driver virtualbox local
denv local
Also works with swarm params:
denv local --swarm swarm-master
dssh() { docker exec -ti $1 /bin/bash }
dexec() { img="$1" shift docker exec $img /bin/sh -c "$@" }
[0]: https://github.com/jzelinskie/dotfiles/blob/b2d33f8c601d1b7d...
This is a simple alternative than the solution I wrote about here: https://allysonjulian.com/setting-up-docker-with-xhyve/ which uses docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve).
I've been trying to figure out how to deal with the env variables used by docker, and used a workaround ~/.profile (https://gist.github.com/astrohckr/efceb07887225cbc2ba2). Like the OP, running eval in every terminal session makes me a bit concerned as well.
I'll give dlite a Go.
http://shahruk.com/code/snippets/2016/01/18/Definitive-Guide...
Now, does if I'm working with say Django or Flask, and things behave differently on an AWS server than they do on your local machine, for example — relative paths for file uploads work on localhost, but mess up on AWS. Also file permissions are irritating to work with on AWS, but never an issue on localhost (on a Mac). In such a scenario, is Docker for these issues? I imagine I use Docker, make a "container" and setup everything properly in that, and then just move it to AWS when I'm deploying?
Why is the xhyve virtualization framework through low-level go-bindings better than using VirtualBox for the same task?
> Why is the xhyve virtualization framework through low-level
> go-bindings better than using VirtualBox for the same task?
Presumably, because xhyve uses the native os virtualization framework, and as such does not require custom third party kernel modules. It also apparently works a bit better with the native os scheduler.I can see advantages for running docker as a way of streamlining dev environments, and keeping them consistent across team members, but by automagicaly awaying the docker-machine env commands you have effectively lost the most powerful facet of container technology.
Perhaps we would all do better if Docker's toolset docs were written in a way to communicate these design decisions (their purpose, and how they conceptually work behind the scenes)...
It might be neat if this were integrated into docker-machine though. Looks like there's already a docker-machine plugin for xhyve (https://github.com/zchee/docker-machine-driver-xhyve).
function docker_activate() { eval $(docker-machine env $1) }
alias docker_activate=docker_activate
Then:
docker-machine start mymachine
docker_activate mymachine
Just forward a port with ssh/socat/etc and set the environment variable correctly to point to your build host that can run lxc.
There is so much over-engineering going on in this arena. :/
The "docker" program builds and runs natively under osx just fine, like any other Go binary.
Personally, I wish more of it worked as transparently as what Joyent provides for their server implementation.