这是indexloc提供的服务,不要输入任何密码
Skip to content

Docker hosted dokku #1076

@Downchuck

Description

@Downchuck

This puts Dokku into a docker container -- for ease of use, I'm just using docker-flatip and socat for glue.

Dockerfile

FROM ubuntu:latest

ENV DOKKU_TAG=v0.3.16

RUN apt-get update
RUN apt-get -y install libpcre3 libssl-dev
RUN apt-get -y install libpcre3-dev
RUN apt-get -y install wget zip gcc

## Dokku
RUN apt-get -y install curl git make ruby
RUN apt-get -y install dnsutils dropbear
RUN wget -qO- https://raw.githubusercontent.com/progrium/dokku/v0.3.16/bootstrap.sh | bash \
 && cd /root/dokku && make -i dokku-installer \
 && rm /etc/nginx/conf.d/dokku-installer.conf \
 && rm /etc/init/dokku-installer.conf \
 && rm -rf /home/dokku \
 && rm -rf /var/lib/apt/lists/*;
# RUN apt-get -y install nginx

EXPOSE 22
EXPOSE 80
VOLUME ["/home/dokku"]

ADD start /start
RUN chmod 755 /start

CMD ["/start"]

/start

#!/bin/bash
set -e

DOKKU_VERISON="v0.3.16"
DOKKU_HOME="/home/dokku"
VHOST=$(hostname)

mkdir -p -m 0700 ${DOKKU_HOME}
chown -R dokku:dokku ${DOKKU_HOME}

echo "${VHOST}" > ${DOKKU_HOME}/HOSTNAME
echo "${VHOST}" > ${DOKKU_HOME}/VHOST
echo "${DOKKU_VERSION}" > ${DOKKU_HOME}/VERSION
cat <<E > ${DOKKU_HOME}/ENV
export CURL_CONNECT_TIMEOUT=5
export CURL_TIMEOUT=30
E

[ -f "/var/run/docker.sock" ] || \
 ln -s ${DOKKU_HOME}/docker.sock /var/run/docker.sock

echo "Starting dropbear...";
dropbear
echo "Starting nginx...";
nginx -g 'daemon off;'

On the host, you will need to link the unix domain socket for docker:

socat unix-listen:/opt/dokku/data/docker.sock,fork unix-connect:/var/run/docker.sock

And it's quite likely you'll want to tweak sshcommand, possibly including it in your host. dropbear does not support: "no-user-rc", you'll want to remove that flag from inside of the sshcommand script.

You can use tools like docker-flatip to export port 22 and 80 on a separate IP address from the host, or you can use standard docker mechanisms to expose these ports.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions