Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

build docker image with non-root build context

Hello,

I have a repository that has 2 directories inside it. These 2 directories represent 2 separate docker projects.

Now with the bitbucket pipeline, I am trying to build the images but the build fails because Docker build context is not able to locate the files required for the build.

 

example:

pipelines:

    default:

         - parallel:

                - step:

                      script:

                           - docker build ${BITBUCKET_CLONE_DIR}/directory_1 --tag ${IMAGE_NAME}

 

 

 

# Dockerfile

# set base image (host OS)

FROM python:3.8
# set the working directory in the container

WORKDIR /code
# copy the dependencies file to the working directory

COPY requirements.txt .        ----- fails at this step


# install dependencies

RUN pip install --no-cache-dir -r requirements.txt


# copy the content of the local src directory to the working directory

COPY src/ .

# command to run on container

CMD [ "python", "./trsync.py" ]

 

Error:

COPY failed: stat /var/lib/docker/165536.165536/tmp/docker-builder235206778/requirements.txt: no such file or directory

 

 

I know this will work if I put the 2 docker projects in 2 different repo and keep the Dockerfile in repository root.

 

 

Thanks,

Amit

 

1 answer

0 votes

Hi @Amit Prakash Singh and welcome to the community.

I suspect the issue here may have to do with the location of the requirements.txt file and the working directory set in the Dockerfile.

In order to be able to better help you, could you please let me know:

1. I assume that you have the first Dockerfile inside directory_1?
2. What is the full path to requirements.txt file inside this repo?

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Service Management

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

67 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you