当前位置: 首页 > 知识库问答 >
问题:

Bitbucket管道。进入另一个容器

翟迪
2023-03-14
# This is a sample build configuration for Javascript.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.5

pipelines:
  default:
    - step:
        script:
          # Step 1 : Install yarn with the easy way : https://yarnpkg.com/en/docs/install#alternatives-tab
          - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.22.0
          # Step 2: Belived https://confluence.atlassian.com/bitbucket/javascript-node-js-with-bitbucket-pipelines-873891287.html#Javascript(Node.js)withBitbucketPipelines-ManagingdependencieswithYarn
          # PATH variable should change like they said
          - export PATH=$HOME/.yarn/bin:$PATH
          # Step 3: Install app dependencies
          - yarn install
          #Allow to test app in production context
          - export NODE_ENV=production
          #Allow to specify the JWT TOKEN Signature (and not use OAuth0)
          - export SECRET_SIGNATURE_JWT_TOKEN=pokémon47
          # prepare PostgreSQL
          # -  psql -U "postgres" -c "CREATE DATABASE custom_db" # create a new database
          # -  psql -U "postgres" -c "CREATE USER custom_user WITH PASSWORD 'custom_pass'" # create a new user : custom_user
          # -  psql -U "postgres" -d "custom_db" -f sql/database_tables.sql # create tables
          # -  psql -U "postgres" -d "custom_db" -f sql/database_grant.sql # give him the credentials
          # -  psql -U "postgres" -d "custom_db" -f sql/test_insert.sql # add basic data inside the database : some parkings and reasons
          #run the test with database
          - npm test
        services:
          - postgres

definitions:
  services:
    postgres:
      image: postgres:9.3
docker ps

docker exec -it myContainer bash
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

PS:如果您想要Postgresql容器中的日志

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok

Success. You can now start the database server using:

    postgres -D /var/lib/postgresql/data
or
    pg_ctl -D /var/lib/postgresql/data -l logfile start

****************************************************
WARNING: No password has been set for the database.
         This will allow anyone with access to the
         Postgres port to access your database. In
         Docker's default configuration, this is
         effectively any other container on the same
         system.

         Use "-e POSTGRES_PASSWORD=password" to set
         it in "docker run".
****************************************************
waiting for server to start....LOG:  database system was shut down at 2017-04-20 12:50:43 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections
 done
server started
ALTER ROLE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

LOG:  received fast shutdown request
LOG:  aborting any active transactions
waiting for server to shut down...LOG:  autovacuum launcher shutting down
LOG:  shutting down
.LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

LOG:  database system was shut down at 2017-04-20 12:50:45 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  received smart shutdown request
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down

共有1个答案

钦枫
2023-03-14

Bitbucket文档试图清晰,但它并不试图帮助用户:

PostgreSQL将在本地主机:5432上可用

问题是,psql不能像您预期的那样工作。它们的默认行为是连接到文件套接字(/var/run/PostgreSQL/.s.pgsql.5432),而不是连接到localhost

 类似资料:
  • 我已经编写了所有的e2e测试,它们在我的本地机器和代码上成功运行。我想把我们的CI从codeship移到Bitbucket管道。所以我用测试环境创建了自己的Docker映像。当我在本地工作区中运行docker conatiner时,测试工作正常,但当build在bitbucket管道中运行时,所有测试都因超时而失败,因为在页面上找不到angular。服务器肯定是在容器中启动和运行的ant测试也开始

  • 我正在使用bitbucket管道,在一个步骤中,我想调用curl请求我们的API来将部署数据保存在DB中。 但是当我试图用BITBUCKET_BRANCH和BITBUCKET_REPO_SLUG变量调用curl时,它们总是为空或者根本没有填充。 这是我从管道中得到的回复。 你可以看到,对于分支dev1/*,我有第一步,我用两个变量调用curl。我尝试了两种使用我在互联网上找到的变量的方法,但都不起

  • 问题内容: 有任何方法可以从具有参数的另一个管道触发管道作业,我已经尝试过 也尝试过 和 没有运气,它说: 项目类型不支持参数 问题答案: 由于子作业是另一个多分支管道项目,因此我需要指定我要运行的分支 现在可以用了

  • 问题内容: 我以为直到现在我都了解* nix管道…我有一个名为的可执行文件,它指向我的安装程序的符号链接,我以为我可以使用 但这是行不通的。它给我的效果等同于仅在当前目录中运行。 如果我跑步,我会得到。如果我运行,我得到的预期输出将显示符号链接位置。 那么,为什么管道版本不起作用?我还没为管道抱怨什么? 问题答案: 为此,您需要: 来自: xargs-从标准输入构建和执行命令行 要完全理解管道的工

  • 根据Andrew Bayer的说法,您不应该向其他人注入声明性管道。将来可能会有人支持它,但可能不会。 我目前正在尝试在管道中启动一个管道,但我想知道我需要做什么才能使它工作。jenkins网页上的文档说明,如果新作业或管道与第一个作业或管道位于同一文件夹中,则可以从直接名称或绝对路径调用它。我已经尝试了所有不同的方法,目前我正在尝试一个文件的绝对路径,我刚刚检查过它一秒钟前存在,但它说它不存在。

  • 经过几个小时的努力,我能够设置我的docker容器。我的yml文件如下: 但是,当我在bild.gradle文件中使用'com.google.android.gms:play-services-location:11.0.2'时,我最终收到以下错误: 非常感谢任何帮助。