Docker and Algorand Sandbox

Usually when I use the Algorand sandbox GitHub - algorand/sandbox: Algorand node sandbox I clone and I start the sandbox on Docker with the following commands:

git clone https://github.com/algorand/sandbox.git
cd sandbox
./sandbox up

However, I would like to avoid running these commands every time and create a docker-compose that does the above operations.
I tried to create both the Dockerfile and the docker-compose.
Dockerfile:

FROM python:3
WORKDIR /docker_sandbox
RUN git clone https://github.com/algorand/sandbox.git

docker-compose:

version: '3'

services:
  docker_sandbox:
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    build: docker_sandbox/
    command: ./sandbox/sandbox up

The docker-compose is located in the root directory and the Dockerfile is in the docker_sandbox folder which is located in the root directory.
Running the docker-compose up --build command from the root directory I get the following output:

So if I understand correctly, you want to use Algorand Sandbox which is based on Docker Compose from a container which you start with Docker Compose. This won’t work. You will not have Docker Compose inside the container. The easiest way is just writing a script that clones Algorand Sandbox optionally and executes sandbox up

If it were a more complicated project I would recommend using Ansible, but not for 3 lines.

Just for fun, if you really want to solve it with Docker Compose, you should install Docker compose inside the container and mount the docker socket from the host… Even if you do that, I am not sure it would work because I don’t know what Algorand Sandbox does and I would not complicate such an easy task with 3 lines more.

1 Like

perfect, thank you so much for the explanation!