The docker attach command attaches the running container and it is very helpful when you want to see what is written in stdout in real time:
$ sudo docker run -d --name=newtest alpine /bin/sh -c "while true; do sleep 2; df -h; done"
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
3690ec4760f9: Pull complete
Digest: sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c
1825927d488bef7328a26556cfd72a54adeb3dd7deafb35e317de31e60c25d67
$ sudo docker attach newtest
Filesystem Size Used Available Use% Mounted on
none 7.7G 3.2G 4.1G 44% /
tmpfs 496.2M 0 496.2M 0% /dev
tmpfs 496.2M 0 496.2M 0% /sys/fs/cgroup
/dev/xvda1 7.7G 3.2G 4.1G 44% /etc/resolv.conf
/dev/xvda1 7.7G 3.2G ...