Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't access existing containers

Alexandr Bashkatov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 25, 2019

Hi everyone,
let's say I have nodejs and postgres containers in my pipeline config and want to run `docker cp` and `docker exec` against postgres container.
My trouble is I can't supply container id to docker cp or exec because even `docker ps -a` gives nothing, not saying about `docker ps -qf somefilter`.
My pipeline
```yaml
image: node:8
pipelines:
  pull-requests:
    '**':
      - step:
        - script:
          - yarn

          # - docker cp && docker exec here
          # - docker ps -a
          - npm test
    services:
      - postgres
      - docker

definitions:
  services:
    postgres:
      image: mdillon/postgis
```

Thanks in advance

1 answer

1 accepted

0 votes
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 16, 2019

Hello Alexandr,

Pipeline Services are not exposed by the Docker Daemon, which is why they are not showing in `docker ps`.

What are you trying to do? If you're trying to just interact with the database normally, then you should be able to use a normal Postgres client (such as psql), as the necessary ports are already exposed in your build container.

You will need to have psql installed in your image. I don't think it's in the node image so you can either:

  • Install it with apt-get as part of your build script.
  • Create a new Docker image that already has it installed when your build starts.

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events