Hi Gitpod folks!
I’d like to launch the containerized application automatically after creating a workspace.
For that, I’m writing .gitpod.yml
like this:
# List the ports you want to expose and what to do when they are served. See https://www.gitpod.io/docs/config-ports/
ports:
- port: 1313
onOpen: open-browser
# List the start up tasks. You can start them in parallel in multiple terminals. See https://www.gitpod.io/docs/config-start-tasks/
tasks:
- command: |
while [[ $(docker info > /dev/null; echo $?) != 0 ]]; do
sleep 1
done
docker run -p 1313:1313 <application-container>
- command: sudo docker-up
This config opens two terminals. One uses the docker
command to launch the containerized application and the second one launches the docker-up
.
I need to wait until the docker-up
launched. If not, docker run
in the first command failed because the docker socket is not ready before the docker-up
launch. The above config works as expected but I feel a bit hacky. Does anyone know the better solution?
Thank you.