We can use the attach command to attach our Terminal's standard input, output, and error (or any combination of the three) to a running container using the ID or name of the container. Let's do this for our quotes container:
$ docker container attach quotes
In this case, we will see every five seconds or so a new quote appearing in the output.
To quit the container without stopping or killing it, we can press the key combination Ctrl+P Ctrl+Q. This detaches us from the container while leaving it running in the background. On the other hand, if we want to detach and stop the container at the same time, we can just press Ctrl+C.
Let's run another container, this time an Nginx web server:
$ docker run -d --name nginx -p 8080:80 nginx:alpine
Here, we run the Alpine version of Nginx as a daemon in a container named nginx....