In this post, we will see how to run the custom image created in the post:
How to push a Docker image into Docker Hub with VS 2019.
In my case, I will run a Web API (.NET Core) Docker container into a macOS system.
We open a Terminal and run the command:
docker run -p 8080:80 commander2020/testdocker
With this command the system will run a Docker container from the image called testdocker.
We analyse the command:
docker run = it creates and run a container from an image
-p 8080:80 = the container will be configured to accept connections on port 80, which we have remapped on port 8080 of the host machine
commander2020/testdocker = this is the name (testdocker) of our images saved on Docker Hub with our username (commander2020) for docker hub.
If we open another Terminal and we run the commands docker ps, we will see the container runs
In order to verify that it works fine, we open a browser and go to http://localhost:8080/users