When you visit the preview URL of an environment, the server may return a 404 error like this:
This means that the environment is responding, but no container is found for this URL.
The problem may be due to the container encountering an error during startup. You can check if it's running properly with the following command:
docker-compose ps <service_name>
Example:
$ docker-compose ps app
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
my_app php-7.4 "/usr/local/bin/entr…" app 5 mins ago Up 5 mins 80/tcp
If your container is restarting in a loop, you can check its logs to identify the error:
$ docker-compose logs <service_name> -f
The output logs will give you valuable insights into the root cause of the issue.
Ensure that all dependencies are properly installed. For example:
$ composer install # For PHP projects
$ npm install # For JavaScript projects
Some applications require compilation before they are functional. For example:
$ npm start # For JavaScript applications
$ php artisan serve # For Laravel projects
Make sure that routing to the container is correctly configured. Check the routing rules.
It is possible that the environment has been paused, and the link you are accessing is outdated. Go back to the corresponding task and click on the preview link to get an updated one.
If the issue persists, contact support.