Help Center/ CodeArts Agent/ FAQs/ Remote Development/ What Should I Do If the Embedded Browser Preview Fails in a Docker Environment?
Updated on 2026-07-29 GMT+08:00
What Should I Do If the Embedded Browser Preview Fails in a Docker Environment?
Symptom
When the compilation environment is Docker, the embedded browser page fails to be previewed.
Solution
- Run the following command to expose the Docker container port to the host machine:
docker run OPTIONS -p host_port:container_port IMAGE COMMAND ARG...
- OPTIONS: optional parameters for custom configurations. For example, -d runs the container in the background, and -v mounts a volume.
- host_port: port number on the host machine, for example, 8080
- container_port: port number in the container, for example, 80. -p 8080:80 maps port 8080 on the host machine to port 80 in the container.
- IMAGE: name of the Docker image, for example, nginx, redis, or myapp:latest
- COMMAND: command executed after the container is started. If this parameter is not specified, the CMD instruction in the image is used by default.
- ARG...: command parameters, for example, arg1 arg2 ..., which are used to pass additional parameters to COMMAND
- Use the IP address of the remote host machine and the mapped port number host_port in 1 to access the service started in Docker. For example, replace the browser address with:
http://IP-address-of-the-host-machine:host_port/baidu.html
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot