# Installing and Using Wireguard, obviously with containers

DevFeed: [Installing and Using Wireguard, obviously with containers](<https://devfeed.tech/articles/installing-and-using-wireguard-obviously-with-containers-35174.md>)

Original publisher: [Read original article](<https://blog.jessfraz.com/post/installing-and-using-wireguard/>)

Published: 2018-06-14T19:17:58Z

Content type: tutorial

Language: en

Sources: [Jessie Frazelle](<https://devfeed.tech/sources/jessie-frazelle.md>)

Topics: [Containers](<https://devfeed.tech/topics/containers.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [networking](<https://devfeed.tech/topics/networking.md>), [Bash](<https://devfeed.tech/topics/bash.md>), [tailscale](<https://devfeed.tech/topics/tailscale.md>)

Tags: [bash](<https://devfeed.tech/tags/bash.md>), [containers](<https://devfeed.tech/tags/containers.md>), [docker](<https://devfeed.tech/tags/docker.md>), [install](<https://devfeed.tech/tags/install.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [networking](<https://devfeed.tech/tags/networking.md>), [tailscale](<https://devfeed.tech/tags/tailscale.md>)

## AI overview

A tutorial on installing the WireGuard kernel module and using WireGuard tools from containers. It explains the host requirements, Docker commands, kernel-building alternative, and packet-routing test steps, and mentions Tailscale as a later cross-platform alternative.

## Source excerpt

Wireguard is the hip, new way to VPN :P No, but seriously I wanted to try it out because it is super interesting and I think the direction it is going is awesome. Read about it on their website if you have not already. What is cool about Wireguard is it integrates into the Linux networking stack so you have a lot of power over interactions with it. In other words, it is very easy to clone the interface into specific containers. Or just use it on your host. If you are new to my blog, I HATEEEE installing things on my host. I run everything in containers. Wireguard is a kernel module. BUT guess what, literally anything can be run in a container. This post is going to go over how to install the Wireguard module by using a container and how to run the tools from a container as well. UPDATE (April 2020): You might want to use Tailscale. It is simple to install and cross platform since it uses the go implementation of wireguard. Then you don't have to mess with the kernel! I will never forget this thread from 2017 ;) so glad to see the go implementation happen! Soooooo waiting for the userspace portable Go implementation. -- Filippo Valsorda 🇮🇹 (@FiloSottile) June 21, 2017 Installing I wrote a Dockerfile for installing the kernel module. You can run it with: $ docker run --rm -it \ --name wireguard \ -v /lib/modules:/lib/modules \ -v /usr/src:/usr/src:ro \ r.j3ss.co/wireguard:install This only works if you have your kernel headers installed in /usr/src and your kernel allows kernel modules (CONFIG_MODULES=y). This will change your kernel modules on your host since you are mounting that directory. If you are like me and set CONFIG_MODULES=n then you can use my kernel-builder Dockerfile to build a custom kernel. $ docker run --rm -it \ -v /usr/src:/usr/src \ -v /lib/modules:/lib/modules \ -v /boot:/boot \ --name kernel-builder \ r.j3ss.co/kernel-builder That will pop you into a bash shell where you can run the following build script to build a specific kernel version. # buil