Piwik Docker 使用链接容器编写错误
Piwik Docker compose error with linnking containers
我克隆了以下项目:https://github.com/indiehosters/piwik
并且我修改了 docker-compose 以便 link 它与带有 wordpress 的 piwik 一起使用:
db:
image: mysql
volumes:
- ./mysql/runtime:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD
app:
image: piwik
links:
- db
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
links:
- app
volumes_from:
- app
environment:
- VIRTUAL_HOST
cron:
image: piwik
links:
- db
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'
db2:
image: mysql:5.7
volumes:
- "./.data/db/wordpress:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress:latest
volumes:
- ".data/www/wordppress:/var/www/html"
links:
- db2
- web
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db2:3306
WORDPRESS_DB_PASSWORD: wordpress
但由于某种原因我得到这个错误:
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.auth.load_config: File doesn't exist
compose.cli.command.get_client: docker-compose version 1.8.0, build 94f7016
docker-py version: 1.9.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket
compose.cli.command.get_client: Docker version: KernelVersion=4.4.0-31-generic, Os=linux, BuildTime=Wed, 20 Apr 2016 14:19:16 -0700, ApiVersion=1.22, Version=1.10.3, GitCommit=20f81dd, Arch=amd64, GoVersion=go1.6.1
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
compose.cli.verbose_proxy.proxy_callable: docker info -> {u'Architecture': u'x86_64',
u'BridgeNfIp6tables': True,
u'BridgeNfIptables': True,
u'CPUSet': True,
u'CPUShares': True,
u'ClusterAdvertise': u'',
u'ClusterStore': u'',
u'Containers': 2,
u'ContainersPaused': 0,
u'ContainersRunning': 0,
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=db', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'mysqld'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
u'Env': [u'MYSQL_ROOT_PASSWORD',
u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=app', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'php-fpm'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
u'PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=cron', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mysql')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('nginx')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'NGINX Docker Maintainers "docker-maint@nginx.com"',
u'Comment': u'',
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'nginx', u'-g', u'daemon off;'],
u'Domainname': u'',
u'Entrypoint': None,
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=db', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mysql')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'mysqld'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
u'Env': [u'MYSQL_ROOT_PASSWORD',
u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=app', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'php-fpm'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
u'PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=cron', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.parallel.feed_queue: Pending: set([<Service: db>, <Service: app>, <Service: web>, <Service: cron>])
compose.parallel.feed_queue: Starting producer thread for <Service: db>
compose.service.start_container_if_stopped: Starting piwik_db_1
compose.cli.verbose_proxy.proxy_callable: docker start <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.cli.verbose_proxy.proxy_callable: docker start -> None
compose.parallel.parallel_execute_iter: Finished processing: <Service: db>
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Starting producer thread for <Service: app>
compose.service.start_container_if_stopped: Starting piwik_app_1
compose.cli.verbose_proxy.proxy_callable: docker start <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.parallel_execute_iter: Failed: <Service: app>
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: <Service: cron> has upstream errors - not processing
compose.parallel.feed_queue: <Service: web> has upstream errors - not processing
compose.parallel.parallel_execute_iter: Failed: <Service: cron>
compose.parallel.feed_queue: Pending: set([])
compose.parallel.parallel_execute_iter: Failed: <Service: web>
compose.parallel.feed_queue: Pending: set([])
ERROR: for app Cannot start service app: Cannot link to a non running container: /piwik_db_1 AS /piwik_app_1/db
compose.cli.main.main: Encountered errors while bringing up the project.
我希望 iis 也可以 link 带有 web
容器的 wordpress
容器,以便能够访问 piwik API.
你有什么想法可以实现吗?
'db' 容器无法启动:
(.venv) root@papaya /s/w/docker-test# docker-compose up db
Creating dockertest_db_1
Attaching to dockertest_db_1
db_1 | error: database is uninitialized and password option is not specified
db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
dockertest_db_1 exited with code 1
这个有效:
(.venv) root@papaya /s/w/docker-test# env MYSQL_ROOT_PASSWORD=hunter2 docker-compose up db
Recreating dockertest_db_1
Attaching to dockertest_db_1
db_1 | Initializing database
db_1 | Database initialized
...
需要导出 docker-compose.yml 中的无值环境变量。
因此您应该更改:
environment:
- MYSQL_ROOT_PASSWORD
进入这个:
environment:
- MYSQL_ROOT_PASSWORD: "somepassword"
我克隆了以下项目:https://github.com/indiehosters/piwik
并且我修改了 docker-compose 以便 link 它与带有 wordpress 的 piwik 一起使用:
db:
image: mysql
volumes:
- ./mysql/runtime:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD
app:
image: piwik
links:
- db
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
links:
- app
volumes_from:
- app
environment:
- VIRTUAL_HOST
cron:
image: piwik
links:
- db
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'
db2:
image: mysql:5.7
volumes:
- "./.data/db/wordpress:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress:latest
volumes:
- ".data/www/wordppress:/var/www/html"
links:
- db2
- web
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db2:3306
WORDPRESS_DB_PASSWORD: wordpress
但由于某种原因我得到这个错误:
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.auth.load_config: File doesn't exist
compose.cli.command.get_client: docker-compose version 1.8.0, build 94f7016
docker-py version: 1.9.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket
compose.cli.command.get_client: Docker version: KernelVersion=4.4.0-31-generic, Os=linux, BuildTime=Wed, 20 Apr 2016 14:19:16 -0700, ApiVersion=1.22, Version=1.10.3, GitCommit=20f81dd, Arch=amd64, GoVersion=go1.6.1
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
compose.cli.verbose_proxy.proxy_callable: docker info -> {u'Architecture': u'x86_64',
u'BridgeNfIp6tables': True,
u'BridgeNfIptables': True,
u'CPUSet': True,
u'CPUShares': True,
u'ClusterAdvertise': u'',
u'ClusterStore': u'',
u'Containers': 2,
u'ContainersPaused': 0,
u'ContainersRunning': 0,
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=db', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'mysqld'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
u'Env': [u'MYSQL_ROOT_PASSWORD',
u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=app', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'php-fpm'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
u'PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=cron', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mysql')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('nginx')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'NGINX Docker Maintainers "docker-maint@nginx.com"',
u'Comment': u'',
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'nginx', u'-g', u'daemon off;'],
u'Domainname': u'',
u'Entrypoint': None,
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=db', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('mysql')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'mysqld'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'mysqld'],
u'Domainname': u'',
u'Entrypoint': [u'docker-entrypoint.sh'],
u'Env': [u'MYSQL_ROOT_PASSWORD',
u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=app', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('piwik')
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {u'Architecture': u'amd64',
u'Author': u'pierre@piwik.org',
u'Comment': u'',
u'Config': {u'ArgsEscaped': True,
u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {u'AppArmorProfile': u'',
u'Args': [u'php-fpm'],
u'Config': {u'AttachStderr': False,
u'AttachStdin': False,
u'AttachStdout': False,
u'Cmd': [u'php-fpm'],
u'Domainname': u'',
u'Entrypoint': [u'/entrypoint.sh'],
u'Env': [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
u'PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c',
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=web', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={u'label': [u'com.docker.compose.project=piwik', u'com.docker.compose.service=cron', u'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.parallel.feed_queue: Pending: set([<Service: db>, <Service: app>, <Service: web>, <Service: cron>])
compose.parallel.feed_queue: Starting producer thread for <Service: db>
compose.service.start_container_if_stopped: Starting piwik_db_1
compose.cli.verbose_proxy.proxy_callable: docker start <- (u'977abffbb37e6e174ca288e74e2c093ebb4e1e647a54263a37171dbef5f28d02')
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.cli.verbose_proxy.proxy_callable: docker start -> None
compose.parallel.parallel_execute_iter: Finished processing: <Service: db>
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: app>, <Service: web>])
compose.parallel.feed_queue: Starting producer thread for <Service: app>
compose.service.start_container_if_stopped: Starting piwik_app_1
compose.cli.verbose_proxy.proxy_callable: docker start <- (u'0616eefb57ced533cda3d0dee0827e76e5af517d728dbe532d4a5144ed7b484d')
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.parallel_execute_iter: Failed: <Service: app>
compose.parallel.feed_queue: Pending: set([<Service: cron>, <Service: web>])
compose.parallel.feed_queue: <Service: cron> has upstream errors - not processing
compose.parallel.feed_queue: <Service: web> has upstream errors - not processing
compose.parallel.parallel_execute_iter: Failed: <Service: cron>
compose.parallel.feed_queue: Pending: set([])
compose.parallel.parallel_execute_iter: Failed: <Service: web>
compose.parallel.feed_queue: Pending: set([])
ERROR: for app Cannot start service app: Cannot link to a non running container: /piwik_db_1 AS /piwik_app_1/db
compose.cli.main.main: Encountered errors while bringing up the project.
我希望 iis 也可以 link 带有 web
容器的 wordpress
容器,以便能够访问 piwik API.
你有什么想法可以实现吗?
'db' 容器无法启动:
(.venv) root@papaya /s/w/docker-test# docker-compose up db
Creating dockertest_db_1
Attaching to dockertest_db_1
db_1 | error: database is uninitialized and password option is not specified
db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
dockertest_db_1 exited with code 1
这个有效:
(.venv) root@papaya /s/w/docker-test# env MYSQL_ROOT_PASSWORD=hunter2 docker-compose up db
Recreating dockertest_db_1
Attaching to dockertest_db_1
db_1 | Initializing database
db_1 | Database initialized
...
需要导出 docker-compose.yml 中的无值环境变量。
因此您应该更改:
environment:
- MYSQL_ROOT_PASSWORD
进入这个:
environment:
- MYSQL_ROOT_PASSWORD: "somepassword"