---> 96dac595afcf
Removing intermediate container efc2aeaa17df
Step 3 : COPY /website /inetpub/wwwroot
---> 34ddc45b3c32
Removing intermediate container 73bd44d5e240
Successfully built 34ddc45b3c32
C:\dockerdemo>docker run ‐‐name demo1 ‐d ‐p 8080:80 demosite ping ‐t
localhost
d7a14c74cf934952670754695959792f8c7695958e769f6ac98f970edb560018
Make sure that you also have the 8080 firewall exception opened on the container
host. Currently to test, you must access from another box, as the connection will not
work on the actual container host OS to a port forward to a container.
To stop the container, delete the container, and remove my custom image, I can use
the following:
C:\dockerdemo>docker stop demo1
demo1
C:\dockerdemo>docker rm demo1
demo1
C:\dockerdemo>docker rmi demosite
Untagged: demosite:latest
Deleted:
sha256:34ddc45b3c32c3be572038e1ca28062fb7229cbdb110ec8e406acb3700ac7d68
Deleted:
sha256:faa5ae99b967cb4b68bac48f98eba30d3bbe375483abb7a8a8abe93b367d88cc
Deleted:
sha256:96dac595afcf0752cc8335e3f683511506980b33f522264f692bf9c6451248b8
Deleted:
sha256:48815155808f823d2e53af41232d578b48e88e243d0d662078bbc4edf4ce4ad4
When you start a container and wish to stipulate a specific network, add the --net
parameter=
Docker run -itd --name=Container1 --net=NATNetwork1 windowsservercore
cmd.exe
You can also connect a container to a network post start by using the docker network
connect
assigned using --ip=
a stopped state.
Another way to map ports is as part of the Dockerfile by using EXPOSE. I add the line at
the end of my Dockerfile to expose port 80:
EXPOSE 80
After building the new image when running, -P must be added (instead of the -p
and can be viewed using docker ps -a. In the example, it shows that port 3232 was