adminer in a kubernetes pod

5/30/2020

I am trying to create a pod with both phpmyadmin and adminer in it. I have the Dockerfile created but I am not sure of the entrypoint needed.

Has anyone accomplished this before? I have everything figured out but the entrypoint...

FROM phpmyadmin/phpmyadmin

ENV MYSQL_DATABASE=${MYSQL_DATABASE}
ENV MYSQL_USER=${MYSQL_USERNAME}
ENV MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
ENV MYSQL_PORT=3381
ENV PMA_USER=${MYSQL_USER}
ENV PMA_PORT=3381
ENV PMA_PASSWORD=${MYSQL_PASSWORD}
ENV PMA_HOST=${MYSQL_HOST}

EXPOSE 8081
ENTRYPOINT [ "executable" ]

FROM adminer:4

ENV POSTGRES_DB=${POSTGRES_DATABASE}
ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}

EXPOSE 8082
ENTRYPOINT [ "?" ]

------UPDATE 1 ---------- after read some comments I spilt my Dockerfiles and will create a yml file for the kube pod

FROM phpmyadmin/phpmyadmin

ENV MYSQL_DATABASE=${MYSQL_DATABASE}
ENV MYSQL_USER=${MYSQL_USERNAME}
ENV MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
ENV MYSQL_PORT=3381
ENV PMA_USER=${MYSQL_USER}
ENV PMA_PORT=3381
ENV PMA_PASSWORD=${MYSQL_PASSWORD}
ENV PMA_HOST=${MYSQL_HOST}

EXPOSE 8081
ENTRYPOINT [ "executable" ]

container 2

FROM adminer:4

ENV POSTGRES_DB=${POSTGRES_DATABASE}
ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}

EXPOSE 8082
ENTRYPOINT [ "?" ]

I am still not sure what the entrypoint script should be

-- Mike3355
docker
kubernetes
pod

2 Answers

5/30/2020

You can't combine two docker images like that. What you've created is a multi-stage build and only the last stage is what ends up in the final image. And even if you used multi-stage copies to carefully fold both into one image, you would need to think through how you will run both things simultaneously. The upstream adminer image uses php -S under the hood.

-- coderanger
Source: StackOverflow

5/30/2020

You'd almost always run this in two separate Deployments. Since the only thing you're doing in this custom Dockerfile is setting environment variables, you don't even need a custom image; you can use the env: part of the pod spec to define environment variables at deploy time.

image: adminer:4 # without PHPMyAdmin
env:
  - name: POSTGRES_DB
    value: [...]       # fixed value in pod spec
    # valueFrom: ...   # or get it from a ConfigMap or Secret

Run two Deployments, with one container in each, and a matching Service for each. (Don't run bare pods, and don't be tempted to put both containers in a single deployment.) If the databases are inside Kubernetes too, use their Services' names and ports; I'd usually expect these to be the "normal" 3306/5432 ports.

-- David Maze
Source: StackOverflow