In this guide, I will walk you through on how to get a bot started with Docker. The following example will be a simple bot that responds with a ping/pong command.
This tutorial assumes you have some knowledge of a Unix-based operating system, terminal/command prompt commands, and a basic knowledge of creating a Discord bot using discord.js.
This tutorial uses the following:
- NodeJS (7.6.x and above)
- Docker (17.04.0 and above)
Docker is a project that automates the deployment of application inside of software containers. This means it will have it's own kernel, system, operating system, etc without directly effecting the host operating system. To put it in easier terms: You put your application inside a mini-fridge. Take that mini-fridge and put it inside of the big refrigerator. The fridge being the server. It has no effect on the fridge's internal mechanisms, and it keeps it "running" inside it's own happy little world.
Let's get you setup with both!
If you have Windows 10 Pro: Docker CE For Windows
If you have Windows 10 Home: Docker Toolbox for Windows
If you have Mac: Docker CE For Mac OS
If you have Mac (All-in-one installer): Docker Toolbox for Mac OS
If you use Debian/Ubuntu:
sudo apt install docker
If you use a Pacman-based Distro:
sudo pacman -S docker
If you use a RHEL-based Distro:
sudo yum install docker
I personally use NVM on Linux, but on Windows/Mac make sure you have the latest version of NodeJS (not LTS at the moment) installed as features used with discord.js
are not supported fully as I will be taking advantage of them.
Windows: NodeJS For Windows
Other: NodeJS
You can verify the versions you installed by executing the following:
Docker:
docker -v
Node:
node -v
Once you have the latest of both for your system installed, let's move on to creating the bot!