Giter Site home page Giter Site logo

docker-znc's Introduction

ZNC for Docker

Run the ZNC IRC Bouncer in a Docker container.

Prerequisites

  1. Install Docker.

Running

ZNC needs to store settings somewhere, so simplest way to run it is to mount a directory from the host machine to /znc-data in the container:

mkdir -p $HOME/.znc
docker run -d -p 6667 -v $HOME/.znc:/znc-data jimeh/znc

This will download the image if needed, and create a default config file in your data directory unless you already have a config in place. The default config has ZNC listening on port 6667. To see which port on the host has been exposed:

docker ps

Or if you want to specify which port to map the default 6667 port to:

docker run -d -p 36667:6667 -v $HOME/.znc:/znc-data jimeh/znc

Resulting in port 36667 on the host mapping to 6667 within the container.

Configuring ZNC

If you've let the container create a default config for you, the default username/password combination is admin/admin. You can access the web-interface to create your own user by pointing your web-browser at the opened port.

For example, if you passed in -p 36667:6667 like above when running the container, the web-interface would be available on: http://hostname:36667/

I'd recommend you create your own user by cloning the admin user, then ensure your new cloned user is set to be an admin user. Once you login with your new user go ahead and delete the default admin user.

External Modules

If you need to use external modules, simply place the original *.cpp source files for the modules in your {DATADIR}/modules directory. The startup script will automatically build all .cpp files in that directory with znc-buildmod every time you start the container.

This ensures that you can easily add new external modules to your znc configuration without having to worry about building them. And it only slows down ZNC's startup with a few seconds.

DATADIR

ZNC stores all it's settings in a Docker volume mounted to /znc-data inside the container.

Mount a Host Directory

The simplest approach is typically to mount a directory off of your host machine into the container. This is done with -v $HOME/.znc:/znc-data like in the example above.

One issue with this though is that ZNC needs to run as it's own user within the container, the directory will have it's ownership changed to UID 1000 (user) and GID 1000 (group). Meaning after the first run, you might need root access to manually modify the data directory.

Use a Volume Container

First we need to create a volume container:

docker run -v /znc-data --name znc-data busybox echo "data for znc"

And then run the znc container using the --volumes-from option instead of -v:

docker run -d -p 6667 --name znc --volumes-from znc-data jimeh/znc

You'll want to periodically back up your znc data to the host:

docker run --volumes-from znc-data -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /znc-data

And restore them later:

docker run --volumes-from znc-data -v $(pwd):/backup busybox tar xvf /backup/backup.tar

Passing Custom Arguments to ZNC

As docker run passes all arguments after the image name to the entrypoint script, the start-znc script simply passes all arguments along to ZNC.

For example, if you want to use the --makepass option, you would run:

docker run -i -t -v $HOME/.znc:/znc-data jimeh/znc --makepass

Make note of the use of -i and -t instead of -d. This attaches us to the container, so we can interact with ZNC's makepass process. With -d it would simply run in the background.

A note about ZNC 1.6

Starting with version 1.6, ZNC now requires ssl/tls certificate verification! This means that it will not connect to your IRC server(s) if they don't present a valid certificate. This is meant to help keep you safer from MitM attacks.

This image installs the debian/ubuntu ca-certificates package so that servers with valid certificates will automatically be connected to ensuring no additional user intervention needed. If one of your servers doesn't have a valid fingerprint, you will need to connect to your bouncer and respond to *status.

See this article for more information.

Building It Yourself

  1. Follow Prerequisites above.
  2. Checkout source: git clone https://github.com/jimeh/docker-znc.git && cd docker-znc
  3. Build container: sudo docker build -t $(whoami)/znc .
  4. Run container: sudo docker run -d -p 6667 -v $HOME/.znc:/znc-data $(whoami)/znc

docker-znc's People

Contributors

jimeh avatar magcius avatar matthardcastle avatar ryanseys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-znc's Issues

Doesn't enable python support

If you wnat to add a git branch + docker index tag for those desiring python that would be great. If not, here are the minor changes needed in case anyone else wants to do this as well:

 # Install build dependencies.
 apt-get update
-apt-get install -y wget build-essential libssl-dev libperl-dev pkg-config
+apt-get install -y software-properties-common python-software-properties
+add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
+apt-get update
+apt-get build-dep -y znc
+apt-get install -y wget

and

-./configure && make && make install
+./configure --enable-python && make && make install

Disable IPv6 by default

Since Docker doesn't enable IPv6 networking by default, you should probably pass --disable-ipv6 to ./configure to ensure that places like chat.freenode.net which have AAAA records can always be connected to.

document how to access webui

Hi, thanks for great docker znc image.
I see documentation mentioning webui but there is no explanation how to access webui once docker is running. Can you please explain that in documentation readme. Thanks.

Integrate the ca-certificates package.

Please have a look at #14, I think that not having to manually trust all the certificates for all the servers that have valid ones would be a great improvement for this docker image.

Base certificates expired.

<*status> |    Signature Algorithm: sha256WithRSAEncryption
<*status> |         69:b7:25:5b:32:0f:c4:66:64:ad:bc:7e:12:a9:ba:ed:47:6d:
<*status> |         6d:9e:93:7c:2f:4e:7b:21:d3:d5:b2:ff:05:2b:d4:f5:cb:a1:
<*status> |         0b:eb:b2:c6:75:20:d6:a5:ed:b7:c9:88:f3:02:2d:40:c3:cb:
<*status> |         1e:5d:7b:a3:43:53:3d:07:0e:91:f4:21:9b:98:6c:12:f5:e4:
<*status> |         f0:ab:31:1b:e9:2f:ee:59:83:fa:4b:3f:68:9a:26:dc:31:ab:
<*status> |         1c:c6:96:f9:d2:69:81:e6:8c:8c:c4:a8:54:f0:b1:b2:50:fe:
<*status> |         87:3f:de:63:2d:e9:48:90:f0:25:cd:19:26:9e:3e:03:c4:7f:
<*status> |         bd:68:15:74:88:70:35:b2:1a:01:cb:52:b1:34:9c:54:90:fa:
<*status> |         00:87:14:2a:3a:ec:5a:d3:73:5f:58:a3:71:9b:aa:88:d9:bc:
<*status> |         e3:62:bd:f3:ca:6a:ab:2e:91:e6:2f:5c:fe:33:2e:77:50:82:
<*status> |         b4:9e:fd:e0:69:33:c0:6c:60:7d:ad:87:9d:ac:40:78:21:a0:
<*status> |         f1:d9:b0:7d:c3:eb:70:2a:32:69:6a:13:50:5c:e2:26:a2:31:
<*status> |         e7:e9:77:73:2f:af:b2:cb:15:a4:e2:36:23:cb:cc:ba:d7:85:
<*status> |         30:2a:eb:ca:29:bb:ca:98:20:0c:53:bb:60:86:4b:b9:79:bc:
<*status> |         3c:97:a8:82
<*status> SHA1: fc:8e:e3:03:1d:a1:5b:87:c8:0e:a5:2a:b8:5d:f4:77:d9:1f:e5:c9
<*status> SHA-256: 26:cc:5e:ad:d3:fc:4b:48:8a:54:03:39:ea:d6:3a:01:11:02:a0:5d:ca:a0:65:33:00:e5:1d:37:d0:9a:47:94
<*status> If you trust this certificate, do /znc AddTrustedServerFingerprint 26:cc:5e:ad:d3:fc:4b:48:8a:54:03:39:ea:d6:3a:01:11:02:a0:5d:ca:a0:65:33:00:e5:1d:37:d0:9a:47:94
<*status> Disconnected from IRC. Reconnecting...

I get this on both libera.chat and oftc.net, so I suspect the certificates in the base image are expired.

It probably just needs a rebuild on the latest updated base image, which I can do - but as this is a public image I suspect it needs to be repushed to the docker registry from here.

SSL?

Does this support ssl out of the box or do I have to screw around with it?

removing --disable-ipv6

Any reason why ipv6 is disabled? I tried building your image without it and everything worked.

Publish a new version

I guess the latest version of docker-znc on the docker repo is not working as I get this error message:

vagrant@precise64:~$ mkdir ~/znc-data
vagrant@precise64:~$ docker run -d -p 6667 -v ~/znc-data:/znc-data jimeh/znc
f0d5a8ccbb3c0be80493dce702c0b93c8935e62ee4266f633175f9b8c0368f28
vagrant@precise64:~$ docker logs f0d5a8ccbb3c0be80493dce702c0b93c8935e62ee4266f633175f9b8c0368f28
cp: cannot open `/src/znc.conf.default' for reading: Permission denied
Checking for list of available modules...
Opening config [/znc-data/configs/znc.conf]... [ No such file ]
Restart ZNC with the --makeconf option if you wish to create this config.
Unrecoverable config error.

However if I clone this, and build, and run. it works just fine.

So I am assuming the problem could be because of a old version on docker repository.

Docker container not starting on boot

The container doesn't seem to be able to survive a reboot. From the logs it looks like ZNC is being issues a SIG [15] signal. Any idea's why?

[root@sd-34204 ~]# docker run -d -p 6667 -vt $HOME/.znc:/znc-data jeromeza/znc
2067cfcf216d7cad77393e94389c5cc3a05c3bc4a31cf7170552c342fd4b0eaf

[root@sd-34204 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2067cfcf216d jeromeza/znc "/entrypoint.sh " 3 seconds ago Up 1 seconds 0.0.0.0:32768->6667/tcp adoring_raman

[root@sd-34204 ~]# docker logs 2067cfcf216d
[ .. ] Checking for list of available modules...
[ >> ] ok
[ .. ] Opening config [/znc-data/configs/znc.conf]...
[ >> ] ok
[ .. ] Loading global module [webadmin]...
[ >> ] [/usr/local/lib/znc/webadmin.so]
[ .. ] Binding to port [6667]...
[ >> ] ok
[ ** ] Loading user [admin]
[ .. ] Loading user module [chansaver]...
[ >> ] ok
[ .. ] Loading user module [controlpanel]...
[ >> ] ok
[ .. ] Loading user module [perform]...
[ >> ] ok
[ ** ] Staying open for debugging [pid: 6]
[ ** ] ZNC 1.6.1 - http://znc.in

[root@sd-34204 ~]# reboot

[root@sd-34204 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2067cfcf216d jeromeza/znc "/entrypoint.sh " 3 minutes ago Exited (15) 2 minutes ago adoring_raman

[root@sd-34204 ~]# docker logs 2067cfcf216d
[ .. ] Checking for list of available modules...
[ >> ] ok
[ .. ] Opening config [/znc-data/configs/znc.conf]...
[ >> ] ok
[ .. ] Loading global module [webadmin]...
[ >> ] [/usr/local/lib/znc/webadmin.so]
[ .. ] Binding to port [6667]...
[ >> ] ok
[ ** ] Loading user [admin]
[ .. ] Loading user module [chansaver]...
[ >> ] ok
[ .. ] Loading user module [controlpanel]...
[ >> ] ok
[ .. ] Loading user module [perform]...
[ >> ] ok
[ ** ] Staying open for debugging [pid: 6]
[ ** ] ZNC 1.6.1 - http://znc.in
[ ** ] Exiting on SIG [15]

Unable to find module [controlpanel]

starting from an empty volume directory:

$ docker run ...
Opening Config [/znc-data/configs/znc.conf]...
Loading Global Module [webadmin]... [/usr/lib/znc/webadmin.so]
Loading user [admin]
Loading Module [chansaver]... [/usr/lib/znc/chansaver.so]
Loading Module [controlpanel]... [ Unable to find module [controlpanel] ]
Unable to find module [controlpanel]
Unrecoverable config error.

Znc cannot Opened

Pls help me how do i run znc ? or how do i install it ? when i run this command (docker run -it --name znc-conf tmaddox/znc:1.0 --makeconf) it said error parsing reference: ''user/.znc:/znc-data'' is not valid repository/tag. i use latest version of docker windows 7

Special characters ÅÄÖ is not displayed for certain bots

Hi,

Thanks for the great image!

Everything works well beside for a specific trivia bot in a channel I like. It is not displaying special characters correctly, they only appear as questions marks. However other channels work out fine. I asked another person with ZNC to check out the channel and it displays fine for him. That makes me think its something regarding the docker image itself or the server Im hosting it on. (Digital Ocean)

I tried cloning this repo and adding encoding as described here:
http://jaredmarkell.com/docker-and-locales/

I could then see that the encoding was set correctly for the container like this:

nilsi@c4e151f13ad4:/# locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

I also tried connecting to the channel without ZNC and then it displayed it correctly so its not my computer or the client Im using.

Any idea what could be wrong here? Could someone using this container check the channel and see if it displays correctly?

Server: irc.quakenet.org:6667
Channel: #grodan

Disconnecting every 33 minutes

For some reason that I can not track down in the logs, the latest version 1.6.1 is having disconnecting issues from the IRC servers that its connected to every 33 minutes.

Modperl

When building image,

Building ZNC Perl bindings library...
Building module modperl...
In file included from /usr/lib/perl5/core_perl/CORE/perl.h:3905:0,
from modperl/module.h:20,
from modperl.cpp:25:
/usr/lib/perl5/core_perl/CORE/inline.h: In function 'void S_cx_popsub_args(PerlInterpreter*, PERL_CONTEXT*)':
/usr/lib/perl5/core_perl/CORE/cop.h:612:13: warning: declaration of 'av' shadows a previous local [-Wshadow]
AV *av = GvAV(PL_defgv);
^
/usr/lib/perl5/core_perl/CORE/inline.h:526:5: note: in expansion of macro 'CX_POP_SAVEARRAY'
CX_POP_SAVEARRAY(cx);
^
In file included from /usr/lib/perl5/core_perl/CORE/perl.h:5853:0,
from modperl/module.h:20,
from modperl.cpp:25:
/usr/lib/perl5/core_perl/CORE/inline.h:518:9: note: shadowed declaration is here
AV *av;
^~
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-reserved-user-defined-literal'
Linking module modperl...

Is this an issue?

Docker container not starting correctly

If I run the container with the -v flag as suggested, then it exits immediately on start. If I add the -t flag then it stays up. Your README doesn't seem to cater for this... Any idea's why?

[root@sd-34204 ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)

[root@sd-34204 ~]# docker info
Containers: 1
Images: 30
Storage Driver: devicemapper
Pool Name: docker-8:2-15598068-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 2.925 GB
Data Space Total: 107.4 GB
Data Space Available: 104.4 GB
Metadata Space Used: 3.019 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.144 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.107-RHEL7 (2015-12-01)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.10.0-327.10.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 1
Total Memory: 1.765 GiB
Name: sd-34204
ID: UQKS:42NV:IMNY:XTDU:WIVW:2YA2:PWL7:YA75:W46C:5SZL:QVQV:URJO
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

[root@sd-34204 moddata]# docker run -d -p 6667 -v $HOME/.znc:/znc-data jeromeza/znc
831d2eea9d1eb88459772e33c55c31cf2ddfcf4e0edbdc94e123c38d51a80fca

[root@sd-34204 moddata]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
831d2eea9d1e jeromeza/znc "/entrypoint.sh " 5 seconds ago Exited (1) 4 seconds ago trusting_goldstine

[root@sd-34204 moddata]# docker run -d -p 6667 -vt $HOME/.znc:/znc-data jeromeza/znc
3d68161681659684890c54e615b8dd229f5bfa750f2ea5c4d2900e40eb5ed4f2

[root@sd-34204 moddata]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d6816168165 jeromeza/znc "/entrypoint.sh " 2 seconds ago Up 1 seconds 0.0.0.0:32778->6667/tcp agitated_panini
831d2eea9d1e jeromeza/znc "/entrypoint.sh " 15 seconds ago Exited (1) 14 seconds ago trusting_goldstine

`znc --makepass`

So how do i run this command in the container in order to change the password in the config file? i don't want to install znc on the host machine (that beats the point of using docker).

at the moment i'm seeing:

$ d run -t -i --rm --name znc_run -p 6667 -v ~/VOLUMES/znc:/znc-data --entrypoint=/bin/sh srid/znc /bin/sh
/bin/sh: 2: /bin/sh: Syntax error: word unexpected (expecting ")")
$

i'll continue to poke ...

Permission denied

Hey there,
I'm running Docker on a Digital Ocean Ubuntu 14.04 VPS.

I run
docker pull jimeh/znc

and then
docker run -t -i --rm -P -v $HOME/.znc:/znc-data jimeh/znc

And I get
2014/07/10 02:49:43 exec: "/usr/local/bin/start-znc": stat /usr/local/bin/start-znc: permission denied

I'm running under a non-root user with sudo privileges and I've created the ~/.znc directory with readwrite perms owned by the user.

Any ideas?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.