在docker-compose ps中名称显示为工作区_而不是项目名称_的原因可能是什么?
Jenkins作业是从/var/lib/jenkins/jobs/build-docker-images/branches/feature-Jenkinsfile.fap3np/workspace执行的,因此在某些地方,它似乎仍使用目录workspace_作为前缀。 / p>
这种行为是否会发生?为什么会这样?
+ COMPOSE_PROJECT_NAME=denpal docker-compose up -d --build
Creating network "denpal_default" with the default driver
Building cli
...
Creating denpal_mariadb_1 ...
Creating denpal_redis_1 ...
Creating denpal_cli_1 ...
Creating denpal_solr_1 ...
[5A[2K
Creating denpal_redis_1 ... [32mdone[0m
[5B[1A[2K
Creating denpal_solr_1 ... [32mdone[0m
[1B[6A[2K
Creating denpal_cli_1 ... [32mdone[0m
[6BCreating denpal_nginx_1 ...
Creating denpal_php_1 ...
[7A[2K
Creating denpal_mariadb_1 ... [32mdone[0m
[7B[4A[2K
Creating denpal_nginx_1 ... [32mdone[0m
[4BCreating denpal_varnish_1 ...
[2A[2K
Creating denpal_php_1 ... [32mdone[0m
[2B[3A[2K
Creating denpal_varnish_1 ... [32mdone[0m
[3B+ docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------
workspace_cli_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_mariadb_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32771->3306/tcp
workspace_nginx_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
workspace_php_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_redis_1 /sbin/tini -- /lagoon/entr ... Up 6379/tcp
workspace_solr_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32770->8983/tcp
workspace_varnish_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
+ docker ps
+ head
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
63ded7e931bc varnish-drupal "/sbin/tini -- /lago…" About a minute ago Up About a minute 8080/tcp denpal_varnish_1
63a377935929 denpal_php "/sbin/tini -- /lago…" About a minute ago Up About a minute 9000/tcp denpal_php_1
a01180c2f378 denpal_nginx "/sbin/tini -- /lago…" About a minute ago Up About a minute 8080/tcp denpal_nginx_1
a27a34d0d266 mariadb-drupal "/sbin/tini -- /lago…" About a minute ago Up About a minute 0.0.0.0:32779->3306/tcp denpal_mariadb_1
932647378b9d denpal "/sbin/tini -- /lago…" About a minute ago Up About a minute 9000/tcp denpal_cli_1
9bb188c80a4c solr:6.6-drupal "/sbin/tini -- /lago…" About a minute ago Up About a minute 0.0.0.0:32778->8983/tcp denpal_solr_1
6e5a7b68631b redis "/sbin/tini -- /lago…" About a minute ago Up About a minute 6379/tcp denpal_redis_1
+ docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------
workspace_cli_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_mariadb_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32771->3306/tcp
workspace_nginx_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
workspace_php_1 /sbin/tini -- /lagoon/entr ... Up 9000/tcp
workspace_redis_1 /sbin/tini -- /lagoon/entr ... Up 6379/tcp
workspace_solr_1 /sbin/tini -- /lagoon/entr ... Up 0.0.0.0:32770->8983/tcp
workspace_varnish_1 /sbin/tini -- /lagoon/entr ... Up 8080/tcp
答案 0 :(得分:1)
您可以使用-p更改前缀名称,使用项目基本目录的前缀是默认行为https://docs.docker.com/compose/reference/envvars/