@@ -7,16 +7,15 @@ Run the [ZNC][] IRC Bouncer in a Docker container.
77## Prerequisites
88
991 . Install [ Docker] [ ] .
10- 2 . Make .znc folder: ` mkdir $HOME/.znc `
1110
12- [ Docker ] : http://docker.io /
11+ [ Docker ] : http://docker.com /
1312
1413## Running
1514
16- To retain your ZNC settings between runs, you'll most likely want to
17- bind a directory from the host to ` /znc-data ` in the container. For
18- example:
15+ ZNC needs to store settings somewhere, so simplest way to run it is to mount a
16+ directory from the host machine to ` /znc-data ` in the container:
1917
18+ mkdir -p $HOME/.znc
2019 docker run -d -p 6667 -v $HOME/.znc:/znc-data jimeh/znc
2120
2221This will download the image if needed, and create a default config file in
@@ -32,8 +31,7 @@ Or if you want to specify which port to map the default 6667 port to:
3231
3332Resulting in port 36667 on the host mapping to 6667 within the container.
3433
35-
36- ## Configuring
34+ ## Configuring ZNC
3735
3836If you've let the container create a default config for you, the default
3937username/password combination is ` admin ` /` admin ` . You can access the
@@ -47,7 +45,6 @@ I'd recommend you create your own user by cloning the admin user, then ensure
4745your new cloned user is set to be an admin user. Once you login with your new
4846user go ahead and delete the default admin user.
4947
50-
5148## External Modules
5249
5350If you need to use external modules, simply place the original ` *.cpp ` source
@@ -59,19 +56,40 @@ This ensures that you can easily add new external modules to your znc
5956configuration without having to worry about building them. And it only slows
6057down ZNC's startup with a few seconds.
6158
59+ ## DATADIR
60+
61+ ZNC stores all it's settings in a Docker volume mounted to ` /znc-data ` inside
62+ the container.
63+
64+ ### Mount a Host Directory
65+
66+ The simplest approach is typically to mount a directory off of your host machine
67+ into the container. This is done with ` -v $HOME/.znc:/znc-data ` like in the
68+ example above.
69+
70+ One issue with this though is that ZNC needs to run as it's own user within the
71+ container, the directory will have it's ownership changed to UID 1000 (user) and
72+ GID 1000 (group). Meaning after the first run, you might need root access to
73+ manually modify the data directory.
74+
75+ ### Use a Volume Container
76+
77+ First we need to create a volume container:
78+
79+ docker run -v /znc-data --name znc-data busybox echo "data for znc"
80+
81+ And then run the znc container using the ` --volumes-from ` option instead of
82+ ` -v ` :
83+
84+ docker run -d -p 6667 --name znc --volumes-from znc-data jimeh/znc
6285
63- ## Notes on DATADIR
86+ You'll want to periodically back up your znc data to the host:
6487
65- ZNC needs a data/config directory to run. Within the container it uses
66- ` /znc-data ` , so to retain this data when shutting down a container, you should
67- mount a directory from the host. Hence ` -v $HOME/.znc:/znc-data ` is part of
68- the instructions above.
88+ docker run --volumes-from znc-data -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /znc-data
6989
70- As ZNC needs to run as it's own user within the container, the directory will
71- have it's ownership changed to UID 1000 (user) and GID 1000 (group). Meaning
72- after the first run, you might need root access to manually modify the data
73- directory.
90+ And restore them later:
7491
92+ docker run --volumes-from znc-data -v $(pwd):/backup busybox tar xvf /backup/backup.tar
7593
7694## Passing Custom Arguments to ZNC
7795
@@ -92,16 +110,17 @@ simply run in the background.
92110
93111Starting with version 1.6, ZNC now requires ssl/tls certificate verification!
94112This means that it will * not* connect to your IRC server(s) if they don't
95- present a valid certificate. This is meant to help keep you safer from
96- MitM attacks.
113+ present a valid certificate. This is meant to help keep you safer from MitM
114+ attacks.
97115
98116This image installs the debian/ubuntu ` ca-certificates `
99- [ package] ( http://packages.ubuntu.com/vivid/ca-certificates ) so that servers
100- with valid certificates will automatically be connected to ensuring no additional
101- user intervention needed. If one of your servers doesn't have a valid fingerprint,
102- you will need to connect to your bouncer and respond to ` *status ` .
117+ [ package] ( http://packages.ubuntu.com/vivid/ca-certificates ) so that servers with
118+ valid certificates will automatically be connected to ensuring no additional
119+ user intervention needed. If one of your servers doesn't have a valid
120+ fingerprint, you will need to connect to your bouncer and respond to ` *status ` .
103121
104- See [ this] ( https://mikaela.info/english/2015/02/24/znc160-ssl.html ) article for more information.
122+ See [ this] ( https://mikaela.info/english/2015/02/24/znc160-ssl.html ) article for
123+ more information.
105124
106125## Building It Yourself
107126
0 commit comments