...
/Running the App Image - Debug and Production Modes
Running the App Image - Debug and Production Modes
Running images in Docker
We'll cover the following...
In the last chapter, we built our app image. Now, it’s time to run that image using docker run
command. This command has multiple options. If you type docker run --help
in the terminal, you’ll get plenty of options for this command, but the right syntax is below.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG…]
[OPTIONS] - any argument related to running the image
[COMMAND] - any command to override CMD if ENTRYPOINT is implemented in Dockerfile
[ARG] - arguments for container shell
Running the app image
If you remember, we previously built our image using flask_app:1.0 tag. Type docker images
into the terminal and verify that your images exist on your system.
The output will be similar to
REPOSITORY TAG IMAGE ID CREATED SIZE
flask_app 1.0 3edb8369bc83 8 minutes ago 952MB
The debug mode
It’s time to run our app using Docker.
Type docker run flask_app:1.0
You’ll get output something like so:
* Serving Flask app "app.py" (lazy loading)
* Environment: development
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 132-810-040
At this point, you won’t be able to access ...