Allow mounting subdirectories of $BITBUCKET_CLONE_DIR for Docker run.

Issue #15508 resolved
Philip Hodder
staff created an issue

Currently when using the Docker run command, it is only possible to mount the $BITBUCKET_CLONE_DIRECTORY. It would be good to allow support for mounting other directories under the $BITBUCKET_CLONE_DIRECTORY

Allow for mounting directories such as:

$ docker run -v $BITBUCKET_CLONE_DIR/app:/app my-container:version

As per this discussion here. Including a few example use-cases: https://community.atlassian.com/t5/Bitbucket-questions/Re-Re-Bitbucket-pipelines-how-can-I-map-a-volume-to-do/qaq-p/703437/comment-id/22253#M22253

Comments (9)

  1. Andy Klaiber

    This isn't working for me. with this config line:

    docker run -d --network="host" --name mysql -v="$BITBUCKET_CLONE_DIR/dbconf:/etc/mysql/conf.d" -e MYSQL_ROOT_PASSWORD=root mysql:5.7
    

    I'm getting the following error:

    docker: Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR.
    
  2. Matthew Jones

    We have suddenly starting getting the error:

    authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR
    

    When mounting a file in the clone directory

    -v $BITBUCKET_CLONE_DIR/.gcloud/application_default_credentials.json:/root/.gcloud/application_default_credentials.json
    

    Has this been rolled back in the last hour or two?

  3. Philip Hodder staff reporter

    Hello @Matthew Jones @Andy Klaiber,

    Unfortunately we had to make some immediate hardening changes to the Docker volume mounting where we were unable to give sufficient notice of these changes. Sorry for the inconvenience.

    We have another issue open for this change specifically that I recommend you follow for updates: https://bitbucket.org/site/master/issues/16470/allow-mounting-subdirectories-of

    We'll be investigating if we can re-enable this mounting strategy in the future.

    For now, you'll have to work around this by mounting the entire $BITBUCKET_CLONE_DIR and cd'ing into the necessary directories inside your Dockerfile.

    Thanks, Phil

  4. Peter Bittner
    ERROR: for build_db_1  Cannot create container for service db: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories
    

    It says, "and its subdirectories"! - Note that this is Docker Compose.

    EDIT: Looks like this is an issue after re-introducing subdirectories to be mounted (issue #16468).

  5. Log in to comment