Docker-compose MemoryError

时间:2016-11-17 10:00:10

标签: python postgresql python-2.7 docker docker-compose

我尝试在512 Mb RAM的vps上启动odoo。 我用docker。当我用普通码头工人发射容器时一切都很好。我这样推出: postgres容器:

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres

odoo容器:

docker run -p 8069:8069 --name odoo --link db:db -t odoo

没有错误,一切正常。然后我关机,移除这个容器并尝试用docker-compose做同样的事情:

app:
    image: odoo
    tty: true
    ports:
        - "8069:8069"
    volumes:
        - ./addons:/mnt/extra-addons:ro,Z
    links:
        - db:db

db:
    image: postgres
    environment:
        POSTGRES_USER: odoo
        POSTGRES_PASSWORD: odoo

当我启动时,我得到MemoryError:

root@ubuntu-512mb-fra1-01:~/odoo# docker-compose -f odoo.yml up
Creating odoo_db_1
Creating odoo_app_1
Attaching to odoo_db_1, odoo_app_1
db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   | 
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   | 
db_1   | Data page checksums are disabled.
db_1   | 
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | creating configuration files ... ok
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.9.0', 'console_scripts', 'docker-compose')()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 65, in main
    command()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 117, in perform_command
    handler(command, command_options)
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 862, in up
    log_printer.run()
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/log_printer.py", line 87, in run
    for line in consume_queue(queue, self.cascade_stop):
  File "/usr/local/lib/python2.7/dist-packages/compose/cli/log_printer.py", line 229, in consume_queue
    raise item.exc
MemoryError

我试图谷歌的原因,但找不到任何东西。

2 个答案:

答案 0 :(得分:6)

正在运行的命令缓冲json,以便它可以正确地拆分它。缓冲可能会占用太多内存。

您可以尝试这样做:

var mainApp = angular.module('mainApp', []).config(config);

config.$inject = ['$routeProvider'];
function config($routeProvider) {
    $provider
    .when('/index',
    {
        templateUrl: '/Views/Admin/index.html'
    }
    );
}

那将运行&#34;分离&#34;。您仍然可以尝试运行docker-compose -f odoo.yml up -d 来查看日志。

答案 1 :(得分:-1)

您可以尝试删除tty:true中的odoo.yml

来自https://github.com/docker/compose/issues/3106