Get docker API engine exec output

I try to get the output from a command Im running inside a container, but I only get it in RAW text so far. I need to be able to get the output with PHP, seems like I cant do that when it returns in RAW text.

Here is my Dockerfile:

FROM phusion/baseimage:0.9.19

CMD ["/sbin/my_init"]


RUN sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d

RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
    nginx \
    php-fpm php-mysql php-gd php-curl php-cli php-mbstring php-dom unzip

RUN service php7.0-fpm start


RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

And here is the curl requests Im running: