Compose: Up a service cause MemoryError

Created on 25 Apr 2017  路  9Comments  路  Source: docker/compose

I am consistently getting a MemoryError on container:

bdhameli@debian:~/Docker$ docker-compose up openvpn
Starting dmzpi_openvpn_1
Attaching to dmzpi_openvpn_1
Traceback (most recent call last):
  File "bin/docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 67, in main
  File "compose/cli/main.py", line 117, in perform_command
  File "compose/cli/main.py", line 937, in up
  File "compose/cli/log_printer.py", line 87, in run
  File "compose/cli/log_printer.py", line 235, in consume_queue
MemoryError

At this point, the container is running normally.

The docker-compose.yml file contains:

services:
  openvpn:
    build: ./openvpn
    cap_add:
      - net_admin
    dns:
      - 8.8.4.4
      - 8.8.8.8
    read_only: true
    tmpfs:
      - /tmp
    restart: unless-stopped
    stdin_open: true
    tty: true
    volumes:
      - ./openvpn/vpn:/vpn
    devices:
      - /dev/net/tun:/dev/net/tun

Docker and Docker-Compose versions are:

:~/Docker$ docker --version
Docker version 17.03.1-ce, build c6d412e
:~/Docker/$ docker-compose version
docker-compose version 1.12.0, build b31ff33
docker-py version: 2.2.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t  3 May 2016
arelogs docker-py kinbug

Most helpful comment

i'm also getting the same error.
is there any workaround to this problem?

edit:
I just removed tty:true and it worked

All 9 comments

Thanks for the report.
Do you get the same error if you run docker-compose logs -f openvpn? What about docker-compose logs --tail=20 -f openvpn?

Hi,

These two commands (docker-compose logs -f openvpn and docker-compose logs --tail=20 -f openvpn) return the same content:

openvpn_1   | Wed Apr 26 07:55:26 2017 OpenVPN 2.3.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Nov 12 2015
openvpn_1   | Wed Apr 26 07:55:26 2017 library versions: OpenSSL 1.0.1t  3 May 2016, LZO 2.08
openvpn_1   | Wed Apr 26 07:55:26 2017 Control Channel Authentication: tls-auth using INLINE static key file
openvpn_1   | Wed Apr 26 07:55:26 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
openvpn_1   | Wed Apr 26 07:55:26 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
openvpn_1   | Wed Apr 26 07:55:26 2017 Socket Buffers: R=[212992->131072] S=[212992->131072]
openvpn_1   | Wed Apr 26 07:55:46 2017 RESOLVE: Cannot resolve host address: #####.########.###: Temporary failure in name resolution
openvpn_1   | Wed Apr 26 07:56:06 2017 RESOLVE: Cannot resolve host address: #####.########.###: Temporary failure in name resolution
openvpn_1   | Wed Apr 26 07:56:06 2017 SIGUSR1[soft,init_instance] received, process restarting
openvpn_1   | Wed Apr 26 07:56:06 2017 Restart pause, 2 second(s)

If helping, the DNS server define in docker-compose.yml for openvpn service can't be reached.

I've got the same problem. It is working when I run docker-compose in daemon mode.

// not working
docker-compose up

// working
docker-compose up -d

ubuntu@myuser:~/api $ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:58:26 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:58:26 2017
 OS/Arch:      linux/amd64
 Experimental: false


ubuntu@myuser:~/api $ docker-compose -v
docker-compose version 1.11.2, build dfed245

I'm also getting the same error in running docker-compose -f docker-compose-1.yml -f docker-compose-2.yml up in a gcloud server. But, on my local system, it is running just fine.

Traceback (most recent call last):
  File "bin/docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 64, in main
  File "compose/cli/main.py", line 116, in perform_command
  File "compose/cli/main.py", line 889, in up
  File "compose/cli/log_printer.py", line 87, in run
  File "compose/cli/log_printer.py", line 229, in consume_queue
MemoryError
Failed to execute script docker-compose

docker-compose-1.yml

version: '2'
services:
  drupal:
    build:
      context: .
      dockerfile: Dockerfile.drupal
    ports:
      - "3700:80"
    restart: always
    networks:
      main:
        aliases:
          - drupal

networks:
  main:

docker-compose-2.yml

version: '2'
services:
  redisMain:
    image: redis:alpine
    command: redis-server /usr/local/etc/redis/redis.conf
    volumes:
      - "./redis/redisMain.conf:/usr/local/etc/redis/redis.conf"
    restart: always
    networks:
      main:
        aliases:
          - redisMain
  rabbitmq:
    image: rabbitmq:management-alpine
    restart: always
    hostname: rabbitmq
    environment:
      RABBITMQ_DEFAULT_USER: app
      RABBITMQ_DEFAULT_PASS: app
    ports:
      - "15672:15672"
    networks:
      main:
        aliases:
          - rabbitmq
  mongodbMain:
    image: mongo:latest
    restart: always
    networks:
      main:
        aliases:
          - mongodbMain
  mysqlMain:
    image: mysql:latest
    volumes:
      - "~/Office/app-db/mysql-data/db:/var/lib/mysql"
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: app
      MYSQL_DATABASE: test_db
      MYSQL_USER: app
      MYSQL_PASSWORD: app
    networks:
      main:
        aliases:
          - mysqlMain
  haproxymain:
    image: haproxy:alpine
    volumes:
      - "./haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
    links:
      - app
    ports:
      - "9000:80"
    restart: always
    networks:
      main:
        aliases:
          - haproxymain
  app:
    depends_on:
       - redisMain
       - mysqlMain
       - mongodbMain
       - rabbitmq
    build:
      context: .
      dockerfile: Dockerfile
      args:
        branch: ${BRANCH}
        # expire: ${EXPIRE}
    tty: true
    restart: always
    networks:
      main:
        aliases:
          - app

networks:
  main:

I'm trying to clone a git repository and do npm install inside it as an entrypoint script in one of my containers.

Also, I tried running it with -d flag. But that doesn't seemed to clone the repo in my container.

Docker version:

dev@dev:~$ docker --version
Docker version 17.03.1-ce, build c6d412e
dev@dev:~$ docker-compose --version
docker-compose version 1.11.2, build dfed245

Could it be the same issue as #409 ? What is the output of ulimit -m in your different environments?

I don't think so :

ubuntu@myuser:~$ ulimit -m
unlimited

Idem:

:~/Docker/dmz-pi$ ulimit -m
unlimited

Output of ulimit -m is same on both environments - glcoud server and my local system.

dev@dev:~$ ulimit -m
unlimited

Also, if run docker-compose up again without doing docker-compose down, then I'm getting a COMPOSE_HTTP_TIMEOUT error and not the MemoryError. What could be the reason behind this?

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

i'm also getting the same error.
is there any workaround to this problem?

edit:
I just removed tty:true and it worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leiblix picture leiblix  路  3Comments

Hendrik-H picture Hendrik-H  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

bitver picture bitver  路  3Comments

dimsav picture dimsav  路  3Comments