Deploy to Docker

Add a Dockerfile
  1. In Solution Explorer, right-click the ServerAPIs project.

  2. Add Docker support and create a Dockerfile.

  3. After the Dockerfile is created, you can view it in the project directory.

Publish the Docker Image
  1. Right-click the ServerAPIs project.

  2. Select Publish > Docker Container Registry.

  3. In the Specific Target page, select Docker Hub.

  4. Enter the Docker Hub username and password.

  5. In the Container Build page, select Dockerfile as the build method.

  6. Click Publish to publish the Docker image.

Run the Docker Container
  1. After publishing is complete, you can view the generated image in Docker Desktop.

  2. Open a command prompt and run the following command to start the container:

    docker run -d -p 5000:8080 --name salesdemocloud_container salesdemocloud                     

    Parameter descriptions:

    • -d: Runs the container in detached mode.

    • -p 5000:8080: Maps port 5000 on the host to port 8080 in the container.

    • --name: Specifies the container name.

Verify the Docker deployment

Access the following URL in a web browser:

http://<ServerIP>:5000/health-ui            

Replace <ServerIP> with the actual IP address of the Docker host machine.

If the page opens successfully, the Docker container is running correctly.