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

ENV in Dockerfile acting differently in pipeline to local Docker

I'm having trouble with backslashes within ENV in a Dockerfile within a pipeline. If I use the same ENV settings in my local Debian environment they are passed through without issue. Image used is debian:buster-slim

 

For example this gets corrupted in the pipeline:
ENV SMTP_PASSWORD='aaaaaaaA\"n111111'

It appears in the container as aaaaaaaA"n

This one just refuses to show up at all in the container but no error is given:
ENV SMTP_PASSWORD='aaaaaaaA\\"n111111'

If I build a docker container locally both of the above examples passthrough as is. Does anyone know how to fix this?

1 answer

0 votes

Hi Rob and welcome to the community.

Could you please let me know where you see this corrupted value of the variable?
- Is it in the output of the 'docker build' command, in the Pipelines build where you build this Dockerfile?
- Is it in the image layers of the Docker repository in the registry you use, after you push the image?
- Or do you use this image you build from the Dockerfile as a build container for Pipelines in another Bitbucket repo, and you see the corrupted value when you echo the variable there?

I haven't been able to reproduce this issue using variables with the same values you mentioned, so it would be useful to have some additional info.

If it's the latter case, can you please check if there is a repository or workspace variable with the same name (SMTP_PASSWORD) defined in the repository that uses this image (or the workspace that owns this repo)? If you have a repository or workspace variable with the same name, I believe that it will overwrite the variable of the container. If a deployment step in Pipelines is using that image as a build container, I also suggest checking the deployment variables as well.

If you're still having issues, it would be useful to know
(a) where and how you see the corrupted value
(b) what value do you see in the output of the 'docker build' command in the Pipelines build where you build this image

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

182 views 2 4
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