Run & Deploy with Docker

This tutorial is a “getting started” to run and deploy ATON framework through Docker.

The prerequisite is indeed you have Docker installed in your machine (generally a server node based on Linux OS). In a Debian Linux environment you can type the following commands from the main ATON folder (if you have Docker installed in a Windows environment, you just need to remove “sudo” from the command).

Quick run

The super-quick way to deploy ATON framework using Docker in a single command is:

sudo docker-compose up

This will build, run and deploy ATON framework on local port 8088 using a basic configuration, after a fresh install of the framework (e.g. after first clone from github). You can find more details and control in the next steps about Docker image, volume (for ATON data) and container.

Build a Docker image of ATON

This step allows to build a docker image of the framework using the base Dockerfile in the main root folder:

sudo docker build -t aton .

Once the command has completed all steps, we’ll have our docker image named “aton“. Keep in mind this will create the image starting from the current ATON instance you have configured in your main folder – including current data, users, scenes, etc. So if you launch this command on a fresh ATON instance, the image will contain base setup with samples and default users.

Note the default Dockerfile will create an image shipping all ATON micro-services. You are free to create custom Dockerfiles that suit your needs or specific infrastructures requirements (e.g. multiple containers, etc.).

Basic deploy

Once we built our docker image, we can create and run a new container from our “aton” image by typing:

sudo docker run -dp 8080:8080 aton

This will run the container with the main ATON service exposed on the host’s port 8080. Notice that when the container will be stopped, all changes will be lost (e.g. new scenes, new users, etc…), since by default all files created inside a container are stored on a writable container layer – see this reference. We have different options for containers to store files persistently on the host machine, one is through volumes.

Create a Docker volume for ATON data

In order to create a Docker volume for our data folder, we can type:

sudo docker volume create aton-data

You can inspect the volume, and where is located on your filesystem, by typing:

sudo docker volume inspect aton-data

which should return something like:

[
  {
  "CreatedAt": "2023-02-27T01:53:53+01:00",
  "Driver": "local",
  "Labels": {},
  "Mountpoint": "/var/snap/docker/common/var-lib-docker/volumes/aton-data/_data",
  "Name": "aton-data",
  "Options": {},
  "Scope": "local"
  }
]

Run an ATON container with persistent data

Now we can run our container mounting our previously created volume, to keep persistent data, by typing:

sudo docker run -dp 8080:8080 --mount type=volume,src=aton-data,target=/aton/data aton

That’s it! You can start/stop your container without losing changes (published 3D scenes, etc.).

You are free to combine and explore a multitude of setups depending on your Docker environment.