For more details, see the [docker build CLI reference](/reference/cli/docker/buildx/build/).
Docker outputs several logs to your console as it builds the image. You'll
see it download and install the dependencies. Depending on your network
connection, this may take several minutes. Docker does have a caching
feature, so subsequent builds can be faster. The console will
return to the prompt when it's complete.
2. Run the image as a container.
In a terminal, run the following command.
```console
$ docker run -it basic-nlp 04_text_summarization.py
```
The following is a break down of the command:
- `docker run`: This is the primary command used to run a new container from
a Docker image.
- `-it`: This is a combination of two options:
- `-i` or `--interactive`: This keeps the standard input (STDIN) open even
if not attached. It lets the container remain running in the
foreground and be interactive.
- `-t` or `--tty`: This allocates a pseudo-TTY, essentially simulating a
terminal, like a command prompt or a shell. It's what lets you
interact with the application inside the container.
- `basic-nlp`: This specifies the name of the Docker image to use for
creating the container. In this case, it's the image named `basic-nlp` that
you created with the `docker build` command.
- `04_text_summarization.py`: This is the script you want to run inside the
Docker container. It gets passed to the `entrypoint.sh` script, which runs
it when the container starts.
For more details, see the [docker run CLI reference](/reference/cli/docker/container/run/).
> [!NOTE]
>
> For Windows users, you may get an error when running the container. Verify
> that the line endings in the `entrypoint.sh` are `LF` (`\n`) and not `CRLF` (`\r\n`),
> then rebuild the image. For more details, see [Avoid unexpected syntax errors, use Unix style line endings for files in containers](/desktop/troubleshoot-and-support/troubleshoot/topics/#Unexpected-syntax-errors-use-Unix-style-line endings-for-files-in-containers).
You will see the following in your console after the container starts.
```console
Enter the text for summarization (type 'exit' to end):
```
3. Test the application.
Enter some text to get the text summarization.
```console
Enter the text for summarization (type 'exit' to end): Artificial intelligence (AI) is a branch of computer science that aims to create machines capable of intelligent behavior. These machines are designed to mimic human cognitive functions such as learning, problem-solving, and decision-making. AI technologies can be classified into two main types: narrow or weak AI, which is designed for a particular task, and general or strong AI, which possesses the ability to understand, learn, and apply knowledge across various domains. One of the most popular approaches in AI is machine learning, where algorithms are trained on large datasets to recognize patterns and make predictions.
Artificial intelligence (AI) is a branch of computer science that aims to create machines capable of intelligent behavior. These machines are designed to mimic human cognitive functions such as learning, problem-solving, and decision-making.
```
## Summary
In this guide, you learned how to build and run a text summarization
application. You learned how to build the application using Python with Bert
Extractive Summarizer, and then set up the environment and run the application
using Docker.
Related information:
- [Docker CLI reference](/reference/cli/docker/)
- [Dockerfile reference](/reference/dockerfile/)
- [Bert Extractive Summarizer](https://github.com/dmmiller612/bert-extractive-summarizer)
- [PyTorch](https://pytorch.org/)
- [Python documentation](https://docs.python.org/3/)
## Next steps
Explore more [natural language processing guides](./_index.md).