As you've done, you need to modify Dockerfile at any time to change the value of the USER and PASSWORD variables. You also need to rebuild the image with docker build -t. .
Obviously, it is not very practical and it is also not very feasible if you want to distribute this image via the Docker Hub so that the user only needs to enter his password through the docker run -e command. >.
First, remember that variables passed through the -e option or the ENV command in Dockerfile have seen environment variables in the shell. So you can have a script file, for example, run.sh . It may look something like this:
#!/bin/bash
git clone git clone https://"$USUARIO_BITBUCKET":"$SENHA_BITBUCKET"@bitbucket.org/.../...
In your Dockerfile, which you will use to create your image, modify it to something like this:
FROM ubuntu
ADD run.sh run.sh
RUN chmod +x run.sh
CMD ./run.sh
When you run this container with the command below, it will use the environment variables passed in the run command.
docker run --name teste -ti -e USUARIO_BITBUCKET=123 -e SENHA_BITBUCKET=123 nomeimagem