Erlang in Docker
| Official image | |
| Run a container | |
| Shell inside container | |
| Exit the container |
Official image
The easiest way to run Erlang in Docker is the official OTP image on Docker Hub. It contains the full Erlang runtime and is updated with each OTP release.
docker pull erlang:latest
The image name is simply "erlang", and the tag is the OTP version, e.g. "27".
Run a container
Start a container in the background with the daemon flag. The -p flag maps a host port to the container's epmd port 4369, which is needed for distributed Erlang.
docker run -d -p 4369:4369 erlang:latest
Shell inside container
Attach to the running container's shell. The erl command starts the interactive shell, and you can run every example from this course.
docker exec -it $(docker ps -q -l) erl
Exit the container
Stop the container with Ctrl-D or the stop command. The container keeps running in the background; you just detach from the shell.
Ctrl-D
Next: Hot code upgrades
Article author: Arthur Isaev