All documentation to install Docker:
Generaly in projects that will be in production we build our own image, but here is a simple demo so, I'm abstracting this step.
Building image:
$ docker build -t demo_app .
The argument
-t
meanstag
the name of our image.
Running:
$ docker run -it -p 8080:8080 demo_app
About arguments:
-i
means--interactive
keep stdin open even if not attached.-t
allocate a pseudo-tty,-p
public a port from container to one port on the machine running the container.
Those arguments will allow you interact with the container as a simple app on your machine, as a exemple without them you will couldn't pass values to create a superuser as requested at the last line of
dockerfile
.
Finally Acess your:
localhost - localhost:8080