Live data from Hacker News

Docker as an Integrated Development Environment (2019)

medium.com

21–30 of 93 posts

Re: Docker as an Integrated Development Environment (2019)

#21

Does anyone use docker for full-fledged development on OSX? I am a Linux user and tried setting up a dev environment for my colleagues on OSX but file system I/O was extremely slow and completely unusable.

IIRC there are some mount options that might help if you search the docker docs, but for me I just create some local docker volumes to hold my code and mount those instead of mounting host folders. It feels a little weird and unnatural that your code is 'hidden' in docker's volume folder (under /var/lib/docker/volumes) in the VM instead of in a folder on your host machine. But it gets you into more of a mindset that this is just a temporary checkout and the real persistent home for the code is your source repository (github, etc.), so you don't let things linger without being checked into a branch somewhere.

Re: Docker as an Integrated Development Environment (2019)

#22
post #3

Can you run ansible or terraform inside a docker container? There are two parts of the dev environment - the programmer preferences and the project libraries and other infrastructure. What I would like is to have a way to compose those two and ideally something that would work the same way inside a docker container as in a full VM.

Grab the ansible-runner image from dockerhub and it's a great slimmed down image to run ansible: https://ansible-runner.readthedocs.io/en/stable/container.ht...

To provision stuff _inside_ your docker container from ansible I've found packer is the easiest way to do it: https://www.packer.io/docs/provisioners/ansible-local There was apparently a tool called ansible-bender that did something similar but was abandoned. Packer makes it easy to define a container that's provisioned with a local ansible playbook.

Ultimately though I think using ansible with containers is a code smell. If you provision in a container with ansible you have to pull in an entire Python install, and that blows up your container size fast. You can do multi-stage builds and carefully extract the stuff you need but it's a real pain. IMHO minimal shell scripts that run in very tightly defined and controlled environments of the dockerfile (i.e. they don't have to be super flexible or support any and every system, just this container) are the way to go.

Re: Docker as an Integrated Development Environment (2019)

#23

Does anyone use docker for full-fledged development on OSX? I am a Linux user and tried setting up a dev environment for my colleagues on OSX but file system I/O was extremely slow and completely unusable.

Yes. Check out what ddev is doing, there’s some options for using NFS mounts that are acceptably fast.

Re: Docker as an Integrated Development Environment (2019)

#24

Does anyone use docker for full-fledged development on OSX? I am a Linux user and tried setting up a dev environment for my colleagues on OSX but file system I/O was extremely slow and completely unusable.

Yep, I use it. There are two tricks to mitigate this:

1. Using a :delegated or :cached flag when using a bind mount can speed it up a bit

2. For folders that need a lot of RW, but don’t need to be shared with the host (think node_modules or sbt cache), I bind a docker volume managed by docker-compose. This makes it extremely fast. Here's an example: https://gist.github.com/kamac/3fbb0548339655d37f3d786de19ae6...

Re: Docker as an Integrated Development Environment (2019)

#25

Does anyone use docker for full-fledged development on OSX? I am a Linux user and tried setting up a dev environment for my colleagues on OSX but file system I/O was extremely slow and completely unusable.

Thanks for the tips guys. Will definitely try them out.

Re: Docker as an Integrated Development Environment (2019)

#26

Does anyone use docker for full-fledged development on OSX? I am a Linux user and tried setting up a dev environment for my colleagues on OSX but file system I/O was extremely slow and completely unusable.

Yes I do. I am trying to develop on OSX since a few days, using Docker. But between the low amount of ram on the laptop and the bad IOs performances I decided to give another try to Github Codespaces and I'm very pleasantly surprised. It feels fast enough and I can switch from computer without thinking about it.

Re: Docker as an Integrated Development Environment (2019)

#27

Nice, similar thing to what I do, a few more things: 1. If you want X11 (haven't figured out audio yet) "-e DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix:ro" 2. Firefox > --shm-size=2g and start with: firefox --no-remote 3. Entering container Just map a command to enter the container with the name as parameter / optional image type as second. That way you get a new fresh environment whenever you want Command would just s…

For audio, maybe you can use pavucontrol on your host to make pulseaudio accept network connections, and then use PULSE_SERVER=your_host_ip command_which_plays_audio in the docker container? (I haven't tried it).

Re: Docker as an Integrated Development Environment (2019)

#29
post #27

Nice, similar thing to what I do, a few more things: 1. If you want X11 (haven't figured out audio yet) "-e DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix:ro" 2. Firefox > --shm-size=2g and start with: firefox --no-remote 3. Entering container Just map a command to enter the container with the name as parameter / optional image type as second. That way you get a new fresh environment whenever you want Command would just s…

For audio, maybe you can use pavucontrol on your host to make pulseaudio accept network connections, and then use PULSE_SERVER=your_host_ip command_which_plays_audio in the docker container? (I haven't tried it).

or better (because there's no nasty reachability from browsers or the net) just use an unix-domain-socket and bind mount that and the secret cookie to the container (I use that with bubblewrap for appimages)
Post reply on HN