How to pass the output of a command to next command in ubuntu? [duplicate]

This question already has an answer here:

I am trying to pass the output of a docker command to next command in ubuntu. I would like to do something like this.

First I build an image then I obtain the container id using the following command:

 docker ps -aqf "name=python_flask"

Which in turn gives me the container id for eg: 75b63270741c, next I would like to exec into the container bash like:

 docker exec -it <container_id> bash

How can I pass the container id obtained previously to this command?

Thanks in advance!

Source: StackOverflow