Build and run ejabberd server using Docker on Raspberry Pi

32 || 0  || 2018-04-14 06:05:43 || root || || Bash

Use the following commands to build Docker image and run a container. All commands below are compatible with Raspbian 8 (jessie).

The list below also contains commands related to Let’s Encrypt certificate for the jabber server. DON'T FORGET to change to your real domain name!

Dockerfile itself can be found here:

# Go to the directory with the Dockerfile
cd /home/docker/ejabberd/

# Build new image
docker build --no-cache -t ejabberd:18.03.0 .

# Request new certificate or renew old one
certbot certonly --manual -d --config-dir /home/docker/ejabberd/certbot/config --logs-dir /home/docker/ejabberd/certbot/logs --work-dir /home/docker/ejabberd/certbot --preferred-challenges dns

# Concatenate all required files (cert, chain, key) to one file:
cat /home/docker/ejabberd/certbot/config/live/ /home/docker/ejabberd/certbot/config/live/ /home/docker/ejabberd/certbot/ca.crt > /home/docker/ejabberd/certs/jabber_example_com.pem

# Start new container
docker run -d -p 5222:5222 -p 5280:5280 -p 5443:5443 -v /home/docker/ejabberd/certs:/home/ejabberd/certs -v /home/docker/ejabberd/logs:/home/ejabberd/logs -v /home/docker/ejabberd/database:/home/ejabberd/database -v /home/docker/ejabberd/uploads:/home/ejabberd/uploads --restart=always ejabberd:18.03.0

# Check your ejabberd SSL certificate
openssl s_client -connect -starttls xmpp | openssl x509 -noout -dates