Finally, run the built image in a container. The -d flag tells Docker to run your container in the background and -p 3000:3000 tells it to bind it to localhost:3000.
docker run -d -p 3000:3000 my-app:latest
Visit http://localhost:3000 in the browser and you’ll see your app running. Nicely done!
Docker Compose helps you start multiple containers at once defined in a docker-compose.yml file.
Again, if you created an Alchemy app with the installer script a docker-compose.yml are already included in your project.
If you didn’t, here’s a simple one that you can use. It runs three services based on your project - an app that serves to localhost:3000, a scheduler, and a queue worker.
Once you’ve created a docker-compose.yml file, you can easily start all three of these services in separate docker containers. Like before, the -d flag runs it in the background.
docker compose up -d
Shutting all three of them down is just as simple.