Docker attach gives empty new line

Looking further based on the hints fomr @pfaffman and @Ed_S, this answer from SO explained it well (accepted answer)

EDIT: the point is that a web server is running on the image, so docker attach doesn’t work, but the exec command does