docker-compose // piwik // 运行期间出错

docker-compose // piwik // 运行期间出错

我尝试将我的所有应用程序切换到docker。

配置:

我使用 nginx 作为服务器。使用 docker 我将使用它作为代理:

# nginx -v
nginx version: nginx/1.4.6 (Ubuntu)

Docker 版本:

# docker version
Client:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:30:23 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:30:23 2016
 OS/Arch:      linux/amd64

# docker-compose -version
docker-compose version 1.7.1, build 0a9ab35

安装:

要安装 piwik,我使用这里建议的文件: indiehosters/piwik

但是我做了一些改变,因为我想要: - 我想使用自定义数据库,所以我配置了一个额外的用户和密码。 - 我想通过应用程序使用不同的 mysql 容器,所以我将数据库更改为 piwik_db(我不确定这是否是一个好的做法) - 我想获得 phpmyadmin 访问权限,但我不明白如何使它与第 2 点一起工作。所以我删除了配置部分。

所以我的 docker compose 文件看起来像这样:

piwik_db:
  image: mysql
  volumes:
    - ./mysql/runtime:/var/lib/mysql
  environment:
    MYSQL_ROOT_PASSWORD: P@ssR00t
    MYSQL_DATABASE: analytics
    MYSQL_USER: admin
    MYSQL_PASSWORD: P@ssUser
app:
  image: piwik
  links:
    - piwik_db:mysql
  volumes:
    - ./config:/var/www/html/config
    - ./ssmtp.conf:/etc/ssmtp/ssmtp.conf
    - ./revaliases:/etc/ssmtp/revaliases
web:
  image: nginx
  volumes:
    - ./nginx.conf:/etc/nginx/nginx.conf:ro
    - ./etc/letsencrypt:/etc/letsencrypt
  links:
    - app
  volumes_from:
    - app
  ports:
    - "8000:443"
cron:
  image: piwik
  links:
    - piwik_db:mysql
  volumes_from:
    - app
  entrypoint: |
    bash -c 'bash -s <<EOF
    trap "break;exit" SIGHUP SIGINT SIGTERM
    while /bin/true; do
      su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive" www-data
      sleep 3600
    done
    EOF'

结果:

当我运行时docker-compose up,它以错误结束:

ERROR: for web  rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose/cli/main.py", line 63, in main
AttributeError: 'ProjectError' object has no attribute 'msg'
docker-compose returned -1

当我测试安装了哪些容器时,我得到

# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
f0388c2a89d3        piwik               "bash -c 'bash -s <<E"   About a minute ago   Up 59 seconds       9000/tcp            htdocs_cron_1
ef5d6c8c6e74        mysql               "docker-entrypoint.sh"   About a minute ago   Up About a minute   3306/tcp            htdocs_piwik_db_1

为什么我会收到这个错误? 如何实现安装? 如何让应用程序一直运行?

预先感谢您的任何帮助。


附言:我仍然在站点中使用我的 nginx 配置:

server {
        listen 80;
        listen [::]:80;

        server_name  piwik.domain.com;
        # Redirige le HTTP vers le HTTPS #
        return         301 https://$server_name$request_uri;
}
server {

        ##
        # config SSL
        ##

        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/piwik.domain.com.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/piwik.domain.com.com/privkey.pem;
        keepalive_timeout    70;
        ssl_session_cache    shared:SSL:10m;
        ssl_session_timeout  10m;
        fastcgi_param HTTPS on;
        # add Strict-Transport-Security to prevent man in the middle attacks
        add_header Strict-Transport-Security "max-age=31536000";

        server_name piwik.domain.com.com;
        server_name_in_redirect off;

        root /usr/share/nginx/html/piwik.domain.com.com/htdocs;
        index index.php index.html index.htm;

        # Logs
        access_log /var/log/analytics.access_log;
        error_log /var/log/analytics.error_log;

        # Default location settings
        location / {
                try_files $uri $uri/ /index.php?$args;
                charset utf-8;
                client_max_body_size 20M;
        }

        # Images and static content is treated different
        location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|html|woff|woff2|ttf|svg|eot|otf)$ {
                add_header Access-Control-Allow-Origin *;
                expires 360d;
                access_log off;
                add_header Cache-Control "public";
        }

        # Deny access to .htaccess files, if Apache's document root
        location ~ /\.ht {
                deny  all;
        }

        location ~ /(libraries|setup/frames|setup/libs) {
                deny all;
                return 404;
        }

        # Pass the PHP scripts to FastCGI server
        location ~* \.php$ {
                # Prevent Zero-day exploit
                try_files $uri =404;
                #
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }

        # Redirect server error pages to the static page
        error_page   403  /403.html;
        error_page 404 /404.html;
        error_page   500 502 503 504  /50x.html;

        # Exclude from the logs to avoid bloating when it's not available
        include drop.conf;

}

答案1

就我而言,问题是因为在撰写文件中,它试图挂载文件而不是文件夹,更改它解决了该问题

相关内容