Gtk: cannot open display: から抜け出した話(Docker + Alpine + Headless Chrome)

やりたかった事

Docker + Alpine + Headless Chrome(Chromium)

エラー

# chromium-browser --headless --no-sandbox --disable-gpu https://example.com/
[13:13:0206/065509.959968:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display:
いろんな文献を見たけどうまくいかず...

解決

今までのDockerfile
FROM alpine:3.5

RUN apk update && \
    apk upgrade && \
    apk add --no-cache \
    bash \
    curl-dev \
    ruby-dev \
    build-base \
    git \
    ruby \
    ruby-irb \
    ruby-io-console \
    ruby-rdoc \
    ruby-bundler \
    mariadb-dev

RUN apk add --update \
            udev \
            ttf-freefont \
            chromium \
            openssl \
            chromium-chromedriver \
            gfortran \
            gcc \
            g++

WORKDIR /root/src

CMD ["top"]
新しいDockerfile
FROM alpine:3.7

RUN apk update && \
    apk upgrade && \
    apk add --no-cache \
    bash \
    curl-dev \
    ruby-dev \
    build-base \
    git \
    ruby \
    ruby-irb \
    ruby-io-console \
    ruby-rdoc \
    ruby-bundler \
    mariadb-dev

RUN apk add --update \
            udev \
            ttf-freefont \
            chromium \
            openssl \
            chromium-chromedriver \
            gfortran \
            gcc \
            g++

WORKDIR /root/src

CMD ["top"]
alpineのバージョンが問題みたいでした...