42

i have a docker-compose.yml that looks like this:

webserver:
  build: ./_docker/php
  ports:
    - 80:80
  links:
    - mysql
  volumes_from:
    - app

mysql:
  image: mysql:5.7
  environment:
    MYSQL_DATABASE: "${DB_NAME}"
    MYSQL_USER: "${DB_USER}"
    MYSQL_ROOT_PASSWORD: "${DB_ROOT_PW}"
    MYSQL_PASSWORD: "${DB_PW}"
  volumes:
    - ./_docker/data/db:/docker-entrypoint-initdb.d
  volumes_from:
    - data

data:
  image: mysql:5.7
  volumes:
    - /var/lib/mysql
  command: "true"

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  ports:
    - 8080:80
  links:
    - mysql
  environment:
    PMA_HOST: mysql

app:
  image: tianon/true
  volumes:
    - .:/var/www/public_html

Dockerfile looks like this:

FROM php:7.0-apache
#php:7.2.2-apache
#php:5.6.33-apache

COPY php.ini /usr/local/etc/php/

COPY 000-default.conf /etc/apache2/sites-available/

RUN a2enmod rewrite
RUN a2enmod expires
RUN a2enmod headers

RUN apt-get update
RUN apt-get install -y zlib1g-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12.0 imagemagick
RUN docker-php-ext-install mysqli zip soap
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd

# Install opcache
RUN docker-php-ext-install opcache

and the php ini like this:

max_input_vars = 1500
max_execution_time = 300
post_max_size=50M
upload_max_filesize=50M

when i start the container i have my webserver located on http://localhost.

i put an index.php with a phpinfo(); inside it and it shows, that the php.ini works.

When i open http://localhost:8080 and login to PMA it shows me that my upload limit i set to 2048KiB.

Where can i change this?

Thanks in advance!

lvollmer
  • 1,418
  • 2
  • 13
  • 32
  • 3
    You dockerfile PHP configurations won't affect phpmyadmin since it's not inside your `app` container. See https://hub.docker.com/r/phpmyadmin/phpmyadmin/ probably there's some tip there. – Elias Soares Nov 14 '19 at 23:59
  • 1
    Try pulling the latest version of phpmyadmin (docker-compose pull) – Elias Soares Nov 15 '19 at 00:05
  • 1
    https://github.com/phpmyadmin/docker/pull/241 the limit was changed to 2mb then reverted back to 512mb in this pull request. – Elias Soares Nov 15 '19 at 00:05
  • 1
    Had the same problem and solved it by adding `UPLOAD_LIMIT: 1G` in my docker-compose.yml. – filtermusic Feb 19 '20 at 22:44

10 Answers10

128

Use like this UPLOAD_LIMIT env in docker. This is from my docker-compose.yml. Default value for UPLOAD_LIMIT is 2048K which is 2048KiB. Setting value to 300M increases it to 300MiB.

Reference: https://github.com/phpmyadmin/docker#environment-variables-summary

 phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: 'php7.3-phpmyadmin'
    restart: 'always'
    links:
      - mysql
    environment:
      PMA_HOST: mysql
      PMA_PORT: 3306
      UPLOAD_LIMIT: 300M
    ports:
      - '8082:80'
    volumes:
      - /sessions
Pratik
  • 959
  • 1
  • 14
  • 20
Abhishek Jangid
  • 1,304
  • 1
  • 7
  • 4
  • 2
    For docker-compose version '3.6' the environment variable should read UPLOAD_LIMIT=30M. Not sure about other versions – AreaEuro May 08 '21 at 18:39
10

you need to use UPLOAD_LIMIT inside enviroment, and you need to specify values with = sign, like example: UPLOAD_LIMIT=300M

version: '3.1'
services:
  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: somerandompasswordgenerated
    ports:
      - 3306:3306

  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      - PMA_ARBITRARY=1
      - UPLOAD_LIMIT=300M
Felipe Illanes
  • 419
  • 5
  • 8
  • 1
    Yep - UPLOAD_LIMIT=300M. The "=" instead of a ":" does the trick out of the box as environment variable specifically for the section "phpmyadmin" in the .yml-file; with Docker Compose version v2.2.3 for phpMyAdmin v 5.1.3; Docker Desktop 4.5.1 on a Windows 11 Home using WSL 2 with a docker image of MySQL 8.0.1 – K. Kilian Lindberg Mar 13 '22 at 10:19
  • In my mentioned context I tested and confirmed this also applies to Docker Compose version 2.0, version 3.0 and 3.4. – K. Kilian Lindberg Mar 13 '22 at 10:48
8

I implemented UPLOAD_LIMIT ENV variable in

https://github.com/phpmyadmin/docker/pull/261/files#diff-80edf79b0f382a3c6e871ac209ffd6abR57

William Desportes
  • 1,412
  • 1
  • 22
  • 31
8

UPLOAD_LIMIT: 500M

mariadb:
    image: mariadb:latest
    container_name: w-mariadb
    restart: always
    ports:
      - "3307:3306"
    environment:
      MYSQL_DATABASE: db_name
      MYSQL_USER: root
      MYSQL_PASSWORD: db_password
      MYSQL_ROOT_PASSWORD: db_password
    volumes:
      - 'w-mariadb:/var/lib/mysql'
    networks:
      - w-network
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: w-phpmyadmin
    links:
      - mariadb
    environment:
      MYSQL_ROOT_PASSWORD: db_password
      PMA_HOST: mariadb
      UPLOAD_LIMIT: 500M
    restart: always
    ports:
      - '8383:80'
    networks:
      - w-network
Hossein Shafiei
  • 111
  • 1
  • 3
4

the following worked very well. My docker-compose.yml contains this:

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: some-name
    env_file:
      - phpmyadmin.env
    depends_on:
      - mariadb
    volumes:

The following entry was added to the phpmyadmin.env: UPLOAD_LIMIT=256MB The larger number (Maximal: 256MiB) showed up right after the container was brought down and was back up again.

  • 2
    It should be `256M` and not `256MB` – ThibaultV Aug 11 '20 at 21:56
  • Man, I was trying this to fix this for like 8 - 10 hours when setting up laradock on my new PC (old one works perfectly). Somehow, this was the only thing that worked. To clarify, I just created a phpmyadmin.env file in root of docker compose folder, with that single line of UPLOAD_LIMIT=? and a newline at the end, and referenced it in phpmyadmin service like you did. THANK YOU SO MUCH! God bless you, sir. – MagisterMundus Jul 22 '23 at 22:04
3

In my case I couldn't fix it with UPLOAD_LIMIT, so without further debugging I needed a quick solution even if it's temporary:

  1. open phpmyadmin container terminal: docker exec -it container_name bash

  2. If you don't have vim or nano editor install one: apt-get update, apt-get install vim

  3. create config file: vi /usr/local/php/conf.d/myconf.ini
  4. with this content: post_max_size=50M upload_max_filesize=50M

  5. restart container

Remember these changes will be gone when container is recreated, it's just a temporary solution. Try working with UPLOAD_LIMIT as suggested in previous answer.

UPDATE Tried again with setting upload_limit environment, but still without luck, so found another solution: created a file say uploads.ini with this content:

post_max_size=50M 
upload_max_filesize=50M

and link it to container volume :

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    links: 
      - mysql:db
    ports:
      - 8084:80
    volumes:
      - ./uploads.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
    environment:
      MYSQL_ROOT_PASSWORD: something
      #UPLOAD_LIMIT: 3000000000 <-- didn't work
temirbek
  • 1,415
  • 1
  • 14
  • 27
3

I edit this file :

/usr/local/etc/php/conf.d/phpmyadmin-misc.ini

and set new values :

post_max_size=64M
upload_max_filesize=64M

It works fine.

E.J.
  • 31
  • 3
2

If you want to install from phpmyadmin docker image and with docker run, you can exec this.

docker run --name your-image-name -d --link mysql-docker:db --env "UPLOAD_LIMIT=256M" phpmyadmin

This works for me and enable upload to 256MB SQL file.

0

Need rebuild container after change UPLOAD_LIMIT

docker-compose up -d --force-recreate --build phpmyadmin
0

For Docker Desktop users: when you run the image, open the Optional settings and at the Environment variables you can set the Variable to UPLOAD_LIMIT and the Value to 256M.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 22 '23 at 15:28