Is it possible to add a package to a docker build after built?

We have a Dockefile in our repo and I’m wanting to install postgres in the image as part of the CircleCI dependency stage.

Is this possible?

dependencies:
  pre:
    - docker info
    - docker build -t my_image .
    - docker run -it --entrypoint=/bin/bash my_image:latest -s
    - apt-get install -y postgresql
    - service postgresql restart
    - su - postgres -c "echo \"create user my_user with password 'foo';\" | psql"
    - su - postgres -c "echo \"create database circle_test;\" | psql"
    - su - postgres -c "echo \"grant all privileges on database circle_test to my_user;\" | psql"

I’m on Enterprise so I can’t use 2.0 and I don’t want to add postgres to my main image since it’ll only be used for testing in this context.

I also can’t rely on the system / host install of postgres because I’m running my tests through the docker image and my version of Enterprise has an older version of Docker which does not support the --network=host flag to allow passthrough of sql connections.