Code demos for the Intro to Containers presentation.
The demos are based on the aspnet-mysql application from this repo.
To learn more about Containers check out the slides.
To build and run the application in this repo:
-
Build the containers
# go to the app folder $ cd app # build the container $ docker build -t aspnet . # run the container $ docker run -p 80:80 aspnet
The
-t aspnet
option tags the image with theaspnet
tag. This way we are naming the image, so that we can use it later.The
-p 80:80
option maps the local port 80 to port 80 in the container.
To push the container to a registry (for example, Docker Hub):
-
Go to Docker Hub and create an account.
-
Build the image again, but this time prefix the tag with your username:
# go to the app folder $ cd app # build the container and tag it with your username docker build -t <username>/aspnet . # push the container via its tag docker push <username>/aspnet
-
Login to Docker Hub with your username and password:
$ docker login --username <username> Password: <enter_password>
-
Push the image:
docker push <username>/aspnet
-
The image should now be visible in your Docker Hub account: