Skip to content

Instantly share code, notes, and snippets.

@sobujbd
Created July 25, 2022 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sobujbd/0826cf67c56ef82bd354fe6dd91484b6 to your computer and use it in GitHub Desktop.
Save sobujbd/0826cf67c56ef82bd354fe6dd91484b6 to your computer and use it in GitHub Desktop.
Run joohoi ACME DNS with Docker using different HTTP port.
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
start_acme_dns()
{
sudo docker run --rm --name acmedns -p 53:53 -p 53:53/udp -p 8443:80 -v /path/to/your/acme-dns/config:/etc/acme-dns:ro -v /path/to/your/acme-dns/data:/var/lib/acme-dns -d joohoi/acme-dns
}
stop_acme_dns()
{
RESULT=`docker ps | grep 'joohoi/acme-dns' | awk '{ print $1 }'`
if [[ $RESULT == "" ]];
then
echo -e "$(date --iso=s -u) [WARN] acme dns not running!" 1>&2;
else
echo "$(date --iso=s -u) [INFO] acme dns is running (CID: $RESULT)."
echo "$(date --iso=s -u) [INFO] stopping now..."
sudo docker stop $RESULT
fi
}
status_acme_dns()
{
RESULT=`docker ps | grep 'joohoi/acme-dns' | awk '{ print $1 }'`
if [[ $RESULT == "" ]];
then
echo -e "$(date --iso=s -u) [WARN] acme dns not running!" 1>&2;
else
echo "$(date --iso=s -u) [INFO] acme dns is running (CID: $RESULT)."
fi
}
action=$1
if [ "${1}" == 'start' ];then
start_acme_dns
elif [ "${1}" == 'stop' ];then
stop_acme_dns
elif [ "${1}" == 'status' ];then
status_acme_dns
else
echo "Usage acmedns start|stop|status"
fi
@sobujbd
Copy link
Author

sobujbd commented Jul 25, 2022

Also you may need to enable ufw and allow the desired port.

sudo ufw enable
sudo ufw allow 8383/tcp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment