Skip to content

Instantly share code, notes, and snippets.

@aifrak
Last active September 30, 2025 20:39
Show Gist options
  • Select an option

  • Save aifrak/b1e38b34c55ed8e84e1996574af58ef3 to your computer and use it in GitHub Desktop.

Select an option

Save aifrak/b1e38b34c55ed8e84e1996574af58ef3 to your computer and use it in GitHub Desktop.
Attach a contained Livebook to a contained Elixir node

Attach a contained Livebook to a contained Elixir node

1 - Run Livebook container

  1. "Check that the version of Elixir on the client matches the server" (Source)
  2. In livebook container, publish ports. For example:
    8080:8080
    8081:8081
  3. Add network of the elixir container to the livebook container. To list networks, run docker network ls.
  4. Bind your own folder to /data from the Livebook container.

Summary as docker command:
docker run -p [PORT]:8080 -p [PORT]:8081 --pull always -u $(id -u):$(id -g) -v [LIVEBOOK_FOLDER_PATH]:/data --network [ELIXIR_CONTAINER_NETWORK] livebook/livebook:latest

For example: docker run -p 8080:8080 -p 8081:8081 --pull always -u $(id -u):$(id -g) -v $(pwd):/data --network elixir_network_default livebook/livebook:latest

More info about the docker command here.

Warning for Windows: -u $(id -u):$(id -g) must be removed to avoid right permission issues (Source)

Note for Windows: C: directory is located at /mnt/c/

2 - Start Elixir node

In the Elixir container (container already started): iex --name [NODE_NAME]@[CONTAINER_NAME] --cookie [COOKIE] -S mix

For example: iex --name mynode@elixir-app-1 --cookie mycookie -S mix

3 - Attach Livebook node to Elixir container node

Go to Livebook > Runtime tab > Setting (cog icon) > Configure > Attach Mode > Fill the form fields:

Name:
[NODE_NAME]@[CONTAINER_NAME]
Cookie:
[COOKIE]

For example:
Name:
mynode@elixir-app-1
Cookie:
mycookie

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