I use IRC to keep in touch with my coworkers. Many of my teammates use an IRC proxy or bouncer to stay connected to the channel so they can get caught up on any chatter or see any messages they received while they were away.
In a previous post, Embrace the Remote Development Environment, I wrote about how I set up a home server. What better time to start learning Docker? I thought configuring an IRC bouncer would make for a good first project.
Now, obviously, before we begin, you’ll need to make sure you have Docker installed. My server runs Ubuntu, so it would be unfair to Windows, Mac, and other Linux distributions if I only described how to install it on the platform that I use. I suggest searching for installation instructions for whatever operating system you prefer.
Pull the ‘znc’ Docker image
I used the ‘slim’ version as I don’t need any bells and whistles.
$ docker pull znc-slim
Make a folder for ZNC to store its settings
$ mkdir -p $HOME/.znc
I chose to leave these in my home directory, even though the container is the only one who will read/write from them.
Run ZNC’s first time set up
$ docker run -p 36667 -it $HOME/.znc:/znc-data znc:slim --makeconf
NOTE: if you are running these commands remotely on a server, you’ll want to change one of the options that you pass to Docker so that the host will route traffic to the container. Change the ‘-p’ flag to look like this:
$ docker run -p 36667:36667 -it $HOME/.znc:/znc-data znc:slim --makeconf
It’ll ask you a series of questions. I mainly took the defaults. At the end of its questionnaire, ZNC will be running and you can connect to its web interface by entering something like this into your web browser:
That’s if it’s running on the computer that you’re currently on. If you’re running this remotely on a server, you’ll want to navigate to its IP address, not your local host.
Starting the container normally
If you exited out of that first time setup in the interactive Docker session, you can start your container normally like so:
$ docker run -p 36667:36667 -v $HOME/.znc:/znc-data znc:slim
As mentioned above, ZNC will be configured via its web interface that you navigate to in your web browser. When you add networks there, it will show you how to connect your IRC client to your bouncer.
Typically, you just update the server information in your IRC client to point at the bouncer’s IP address (whichever computer is running the Docker container) and the port you used (we used 36667). Then, you connect by setting the username for that server in your client to USERNAME/SERVER.