replying to a 6 years old question.
The direct way to store into a variable is :
LOG_LINE=$(docker logs --tail 1 --timestamps "$container_name" 2>&1 | tail -n 1)