Open source licenses

In episode 196 of the (Python) Podcast.init a very commonly discussed topic among open source programmers is covered, which I wanted to share here. The big takeaway is that just because you put your code publicly visible online, it doesn’t mean that it’s “free” for anyone to use. At least not until you slap a license on top of it, and depending on what your goals are with putting the code publicly visible, you may want to choose the license carefully....

February 4, 2019 · 2 min

Control Docker containers from within container

This is a short note on how to make a container access and control another container on the same host. The trick is to have the “controller” container map the host’s docker.sock into the container. On the host, query the uid and gid of the user which is executing containers: $ id fredrik uid=1026(fredrik) gid=100(users) groups=100(users),10(wheel) The Dockerfile: FROM centos:7 RUN yum update -y && yum install -y \ libtool-ltdl && \ yum clean all # use the uid, gid previously queried RUN useradd -u 1026 -g 100 fredrik # tail -f /dev/null will cause the container to just keep running without exiting ENTRYPOINT chown -R fredrik:users /var/run/docker....

December 14, 2018 · 2 min

Switching between Docker and VirtualBox on Windows 10

As outlined here, Docker for Windows requires Hyper-V. This needs to be disabled before you can run VirtualBox. # Run from elevated prompt (admin privileges) bcdedit /set hypervisorlaunchtype off And to start using Docker for Windows again, re-enable Hyper-V: # Run from elevated prompt (admin privileges) bcdedit /set hypervisorlaunchtype auto A reboot is required in both cases. Note: if you only see 32-bit options when creating a VM in VirtualBox, it could be because you havent disabled Hyper-V....

March 15, 2018 · 1 min

Docker cleanup

Quick and easy way to remove all containers (and their volumes) as well as all images: # Remove containers and their volumes docker stop $(docker ps -a -q) docker rm -v $(docker ps -a -q) # Remove images docker rmi -f $(docker images -q) # Remove unused images docker system prune --all Combine filters, 'xargs etc: # Stop all containers of a certain name docker stop $(docker ps -q --filter name=mycontainer) # Run containers based on folder/file names (use '%' where you want to insert the value corresponding to the file/folder name) touch c1 c2 c3 ls | xargs -I % docker run --rm --name % hello-world:latest

January 29, 2017 · 1 min

Testing and sandboxing with Docker

A quick way to enter an interactive docker container: docker run --rm --interactive --tty -v /localfolder:/containerfolder centos:7 On Windows, use forward slashes for the directory mapping. For a more complex setup, have a look at sandbox-docker.

September 12, 2016 · 1 min
Firefox running in container

Docker for Mac and GUI applications

A quick guide on how to run containers requiring a GUI with Docker for Mac and XQuartz. This guide is assuming the following: OS X 10.11.5 (El Capitan) Docker for Mac 1.12 stable XQuartz 2.7.10 beta 2 Jessie Frazelle’s Firefox Dockerfile Prerequisites XQuartz You’ll need XQuartz, and normally you would probably install it via brew (but not this time): brew cask install xquartz XQuartz 2.7.9, which is the current one provided by brew, has a bug which will prevent you from following this guide....

July 31, 2016 · 1 min