Docker, memory exhausted - docker

I am currently working on my new docker setup. Below is my dockerfile, which is made with php-apache and phpmyadmin. No matter what I do, I get memory exhausted e.g:
Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/html/wp-includes/formatting.php on line 3622
memory_size in php is et so: 1024MB (just for testing), and no mater what I try, this error always appear. Is this something in Docker special that you have to set?
Googling the error, I can se that some people has issues with apcu. I even tried to add
"apc.enable_cli=1", but that makes no difference what so ever.
Edit: Should probably mention that the file itself is not the issue (working on other environments with no memory ex). Its like docker itself is not reacting on the memory limit.
Dockerfile:
services:
mysql:
image: "mysql:latest"
container_name: "examplewp-mysql"
restart: always
environment:
- MYSQL_DATABASE=examplewp
- MYSQL_ROOT_PASSWORD=examplewp
- MYSQL_USER=examplewp
- MYSQL_PASSWORD=examplewp
volumes:
- dbdata:/var/lib/mysql
- ./logs/mysql/:/var/log/mysql
- ./docker/mysql/conf.d:/etc/mysql/conf.d
ports:
- "3307:3306"
networks:
- backend-network
phpmyadmin:
image: "phpmyadmin/phpmyadmin"
container_name: examplewp-phpmyadmin
links:
- mysql
environment:
PMA_HOST: mysql
UPLOAD_LIMIT: 64M
restart: always
ports:
- 9081:80
networks:
- backend-network
php:
image: php:7.4-apache
container_name: examplewp-phpapache
build:
context: ./docker/apache
ports:
- 90:80
volumes:
- ./app:/var/www/html/
- ./Docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini
networks:
- backend-network
networks:
backend-network:
driver: bridge
volumes:
dbdata:
driver: local
Php.ini file:
date.timezone = UTC
log_errors = On
error_log = /var/log/php/error.log
max_execution_time = 10000
post_max_size = 1024M
upload_max_filesize = 1024M
memory_limit = 1024MB

Related

Why is my app not installed? File not found

This is my docker-compose.yml. I am trying to deploy app and mysql,I added network.
version: '3'
services:
#PHP Service
app:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
restart: unless-stopped
environment:
- DB_HOST=mysql
- DB_USER=quantox
- DB_PASS=****
- DB_DATABASE=bookstackapp
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
ports:
- 6875:80
networks:
- app-network
db:
image: mysql:5.7.22
container_name: mysql
restart: unless-stopped
ports:
- 33060:3306
environment:
- MYSQL_ROOT_PASSWORD=***
- TZ=Europe/Budapest
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=****
volumes:
- dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
After I go for up -d
I got
Name Command State Ports
-----------------------------------------------------------------------------------------------
bookstack /init Up 443/tcp, 0.0.0.0:6875->80/tcp,:::6875->80/tcp
mysql docker-entrypoint.sh mysqld Up 0.0.0.0:33060->3306/tcp,:::33060->3306/tcp
But in browser localhost:6875 shows
File not found.
Why? Both my app and mysql are on same network. What should I check now?
When using volumes (-v flags) permissions issues can arise between the host OS and the container, you could avoid this issue by allowing you to specify the user PUID and group PGID.

docker-compose + symfony in windows env

i've installed docker (windows 10) with wsl2 (ubuntu distro) and added my docker-compose.yml
version: '3'
services:
web:
image: nginx:1.20.1
container_name: web
restart: always
ports:
- "80:80"
volumes:
- ./nginx.d.conf:/etc/nginx/conf.d/nginx.conf
- ./nginx.conf:/etc/nginx/nginx.conf
- ./www/my-app:/app
php:
build:
context: .
dockerfile: myphp.dockerFile
container_name: php
restart: always
depends_on:
- web
volumes:
- ./www/my-app:/app
mysql:
image: mariadb:10.3.28
container_name: mysql
restart: always
depends_on:
- php
environment:
MYSQL_ROOT_PASSWORD: '******'
MYSQL_USER: 'root'
MYSQL_PASSWORD: '******'
MYSQL_DATABASE: 'my-database'
command: ["--default-authentication-plugin=mysql_native_password"]
volumes:
- mysqldata:/var/lib/mysql
- ./my.cnf:/etc/mysql/my.cnf
ports:
- 3306:3306
cache:
image: redis:5.0.3
container_name: cache
restart: always
ports:
- 6379:6379
networks:
- my-network
volumes:
- ./cache:/cache
volumes:
mysqldata: {}
networks:
my-network:
driver: "bridge"
So my symfony code is in the /www/my-app window's folder. This includes the /www/my-app/vendor too.
My application is running extremely slow (50-70 seconds). If i'm correct it's because the vendor folder is huge (80MB) and docker creates an image of it every time. Other discussions mentioned that vendor folder sould be moved into a new volume, and here i'm stuck with it. How to move and mount that in this case, and how should the docker-compose.yml look like after it?

NextCloud with OnlyOffice not opening previosly saved documents

OnlyOffice is not opening previously saved documents after doing docker-compose down. I needed to increase the memory of nextcloud instance (docker container) so I proceeded to stop all the containers, modify the docker-compose and set everything up again.
There are no issues with new documents so far but editing previously saved ones OnlyOffice opens a blank document besides the files sizes are intact (no errors in console), still showing KB in NextCloud.
version: "2.3"
services:
nextcloud:
container_name: nextcloud
image: nextcloud:latest
hostname: MYDOMAIN
stdin_open: true
tty: true
restart: always
expose:
- "80"
networks:
- cloud_network
volumes:
- /mnt/apps/nextcloud/data:/var/www/html
environment:
- MYSQL_HOST=mariadb
- PHP_MEMORY_LIMIT=-1
env_file:
- db.env
mem_limit: 8g
depends_on:
- mariadb
mariadb:
container_name: mariadb
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
restart: always
networks:
- cloud_network
volumes:
- mariadb_volume:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=SOMEPASSWORD
env_file:
- db.env
onlyoffice:
container_name: onlyoffice
image: onlyoffice/documentserver:latest
stdin_open: true
tty: true
restart: always
networks:
- cloud_network
expose:
- "80"
volumes:
#- /mnt/apps/onlyoffice/data:/var/www/onlyoffice/Data
- office_data_volume:/var/www/onlyoffice/Data
#- onlyoffice_log_volume:/var/log/onlyoffice
- office_db_volume:/var/lib/postgresql
caddy:
container_name: caddy
image: abiosoft/caddy:no-stats
stdin_open: true
tty: true
restart: always
ports:
- 80:80
- 443:443
networks:
- cloud_network
environment:
- CADDYPATH=/certs
- ACME_AGREE=true
# CHANGE THESE OR THE CONTAINER WILL FAIL TO RUN
- CADDY_LETSENCRYPT_EMAIL=MYEMAIL
- CADDY_EXTERNAL_DOMAIN=MYDOMAIN
volumes:
- /mnt/apps/caddy/certs:/certs:rw
- /mnt/apps/caddy/Caddyfile:/etc/Caddyfile:ro
networks:
cloud_network:
driver: "bridge"
volumes:
office_data_volume:
office_db_volume:
mariadb_volume:
Please also note that you must ALWAYS disconnect you users before stop/restart your container. See https://github.com/ONLYOFFICE/Docker-DocumentServer#document-server-usage-issues
sudo docker exec onlyoffice documentserver-prepare4shutdown.sh
It seems that every time the containers are mounted in a NextCloud + OnlyOffice setup it generates tokens to authorize the access to the documents thru headers.
I solved it by adding a third docker volume to preserve the documentserver files. Fortunately I had a backup of my files, I removed the containers and added them again and everything it's working now.
- office_config_volume:/etc/onlyoffice/documentserver
onlyoffice:
container_name: onlyoffice
image: onlyoffice/documentserver:latest
stdin_open: true
tty: true
restart: unless-stopped
networks:
- cloud_network
expose:
- "80"
volumes:
- office_data_volume:/var/www/onlyoffice/Data
- office_db_volume:/var/lib/postgresql
- office_config_volume:/etc/onlyoffice/documentserver

Elasticsearch docker container taking all my disk space, cannot find where

Here's my docker compose file:
version: '3.5'
services:
elasticsearch:
restart: always
build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
# data
- ./data:/usr/share/elasticsearch/data:rw
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
ELASTIC_PASSWORD: password
networks:
- elk-network
kibana:
restart: always
build:
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro
ports:
- "5601:5601"
networks:
- elk-network
depends_on:
- elasticsearch
networks:
elk-network:
name: elk-network
driver: bridge
I do docker-compose up, each day my drive space gets lower by 3-4gb. If I bash into the containers and look for biggest files, there are no big files. If I do container ls, the containers are only 2gb and don't grow in size.
But if I do docker-compose down, and up again, all my disk space is restored. What is going on? How do I debug what is taking all my space for apparently no reason?
if I look for biggest files on my host machine I believe it's all in the /var/lib/docker (or something similar I lost the exact location before clearing all the space).
Try turning off swap in your host
sudo swapoff -a

Docker Compose - Network_mode:Service: - 2 containers cant talk to each other

Over the last couple weeks I have been getting to grips with docker and decided to teach myself. I’m getting a fairly good grasp of it now and have just ventured out into using docker compose.
I have a docker compose yml file that I found online and have been modfying it to my needs.
Basically this docker compose file runs Sonarr, Radarr, Transmission, openvpn and nginx.
Sonarr and Radarr are using service:vpn as their network so that their traffic passes through the VPN.
NGINX is used as a reverse proxy to get to Sonarr and Radarr at the following urls - http://radarr:7878 & http://sonarr:8989 using “sonarr.myredacteddomain/com” “radarr.myredacteddomain/com” which is working great.
NGINX uses the “Link:” to be able get to sonarr and radarr as you can see from my yml below. Problem i’m now having is that I need Radarr and Sonarr to be able to talk to transmission so that they both know where my download client is located. If on Sonarr I enter transmission:9091 or transmission.myredacteddomain/com Sonarr/Radarr cant see it.
Looking at these containers Radarr and Sonarr dont seem to have an IP address so how is it that NGINX can see them via radarr:7878 etc but Sonarr and Radarr cant see transmission in the same way? Can anyone help me with my yml file here?
version: '3.0'
networks:
default:
ipam:
driver: default
services:
jackett:
image: linuxserver/jackett
depends_on:
- vpn
restart: always
network_mode: "service:vpn"
environment:
PGID: 1000
PUID: 1000
TZ: Europe/London
volumes:
- /mnt/user/config/jackett:/config
- /mnt/user/media/downloads/jackett:/downloads
transmission:
image: linuxserver/transmission:48
depends_on:
- vpn
environment:
TZ: 'Europe/London'
PGID: 1000
PUID: 1000
network_mode: "service:vpn"
tmpfs:
- /tmp
restart: unless-stopped
stdin_open: true
tty: true
volumes:
- /mnt/user/config/transmission:/config
- /mnt/user/media/downloads:/downloads
radarr:
image: linuxserver/radarr
depends_on:
- vpn
restart: always
network_mode: "service:vpn"
environment:
PGID: 1000
PUID: 1000
TZ: Europe/London
volumes:
- /mnt/user/config/radarr:/config
- /mnt/user/media/downloads/complete:/downloads
- /mnt/user/media/movies:/movies
sonarr:
image: linuxserver/sonarr
depends_on:
- vpn
restart: always
network_mode: "service:vpn"
environment:
PGID: 1000
PUID: 1000
TZ: Europe/London
volumes:
- /mnt/user/config/sonarr:/config
- /mnt/user/media/downloads/complete:/downloads
- /mnt/user/media/tvshows:/tv
vpn:
image: dperson/openvpn-client
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
cap_add:
- net_admin
dns:
- 8.8.4.4
- 8.8.8.8
environment:
TZ: 'Europe/London'
read_only: true
tmpfs:
- /tmp
restart: unless-stopped
security_opt:
- label:disable
stdin_open: true
tty: true
volumes:
- /dev/net:/dev/net:z
- /mnt/user/config/vpn:/vpn
web:
image: nginx
depends_on:
- transmission
- sonarr
- jackett
- radarr
environment:
TZ: 'Europe/London'
IPV6: 0
links:
- vpn:transmission
- vpn:jackett
- vpn:radarr
- vpn:sonarr
ports:
- "80:80"
- "443:443"
read_only: true
volumes:
- /mnt/user/config/nginx:/etc/nginx/conf.d:ro
- /mnt/user/config/nginx/ssl:/etc/nginx/ssl:ro
tmpfs:
- /run
- /tmp
- /var/cache/nginx
restart: unless-stopped
stdin_open: true
tty: true
Managed to work it out!
Turns out that containers that are using the Network_Mode:Service:vpn share the ip address of the VPN docker.
Solved my own problem!

Resources