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

Starting BitBucket as a Docker Container for JUnit Test Case Edited

I was able to bring up the Bit Bucket Docker Container with PostGres as the DB. However, I am not sure how I can provide a default user and password and also a default repository when I bring up the Docker Container. Please help. 

I am running another PostGres as a Docker Container @port: 5432

bitbucket =
new GenericContainer<>("atlassian/bitbucket-server:latest")
e ->
new PortBinding(Ports.Binding.bindPort(7990), new ExposedPort(7990))))
.withEnv("ELASTICSEARCH_ENABLED", "false")
.withEnv("JDBC_DRIVER", "org.postgresql.Driver")
.withEnv("JDBC_USER", "postgres")
.withEnv("JDBC_PASSWORD", "password")
.withEnv("BITBUCKET_BASEURL", "http://localhost:7990")
.withEnv("BITBUCKET_USER", "dummyuser")
.withEnv("BITBUCKET_PASSWORD", "password")
//Host to be changed for Linux, host.docker.internal only works for MacOs...
.withEnv("JDBC_URL", "jdbc:postgresql://host.docker.internal:5432/postgres")
.withCreateContainerCmdModifier(cmd -> cmd.withHostName("bitbucket"))
.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("pg")));

CompletableFuture.runAsync(() -> bitbucket.start()).get();

 I have the following questions:

How can I supply a default User and Password so I can start the container without the need for sending POST for new user and repo setup. I also want to setup a default Repository. Both of them set via an ENV variable. 

When I dont add the BITBUCKET_USER and BITBUCKET_PASSWORD, the docker container comes up but the localhost:7990 takes me to a setup screen. Since I am planning to run automated Unit Test, I want basic setup done while the Container starts through configuration setup as in the above GenericContainer() example.

Also, I want a light weight container so I dont need a large memory and CPU footprint for Unit Test

1 answer

0 votes


maybe better wrap into gradle or maven?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

178 views 0 2
Join discussion

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