DEV Community

esteblock
esteblock

Posted on

Docker images for Soroban Preview Releases

Hello! In order to avoid problems when working with several projects that are using different soroban's software's versions, I came up with the idea of creating an docker image for each soroban preview. With this we could run scripts that require different soroban-cli versions, rust versions, soroban rust sdks versions, etc...

I have contrubuted in stellar/soroban-example-dapp repo to use this idea:

Check the repo: https://github.com/esteblock/soroban-preview-docker
Also, images are available in Docker Hub!: https://hub.docker.com/r/esteblock/soroban-preview

Write an issue and collaborate!


How to use it?: Short answer

Just run your script inside the container with your favourite preview setup!

docker exec soroban-preview-7 my_script_requires_soroban_cli_0.6.0.sh
Enter fullscreen mode Exit fullscreen mode

For more information, please check the README.md in the project's repo

How to use it?: Long answer, also using stellar/quickstart

In this exemple we'll use Preview 7.
In order to make calls between docker containers, let's create a docker network

  1. (only once) create a common docker network
docker network create soroban-network
Enter fullscreen mode Exit fullscreen mode
  1. Run the stellar/quickstart container related to your preview (in this case preview 7)
docker run --rm -ti \
  --platform linux/amd64 \
  --name stellar \
  --network soroban-network \
  -p 8000:8000 \
  stellar/quickstart:soroban-dev@sha256:81c23da078c90d0ba220f8fc93414d0ea44608adc616988930529c58df278739 \
  standalone \
  --enable-soroban-rpc \
  --protocol-version 20 
Enter fullscreen mode Exit fullscreen mode
  1. Run the soroban-preview:7 image inside a container named soroban-preview-7. Here we'll also share our current directory.
currentDir=$(pwd)
docker run --volume  ${currentDir}:/workspace \
           --name soroban-preview-7 \
           --interactive \
           --tty \
           -p 8001:8000 \
           --detach \
           --ipc=host \
           --network soroban-network \
           soroban-preview:7
Enter fullscreen mode Exit fullscreen mode
  1. Execute your script inside the soroban-preview-7 container. In your script, instead of using http://localhost:8000, to call the stellar/quickstart container you just need to call stellar:8000, becase "stellar" is the name of the quickstart container that is living int he same docker network.
docker exec soroban-preview-7 ./my_soroban_cli_script.sh MY_ARGS
Enter fullscreen mode Exit fullscreen mode

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More