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")
.withExposedPorts(7990)
.withCreateContainerCmdModifier(
e ->
e.withPortBindings(
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"))
.withStartupTimeout(Duration.ofSeconds(480))
.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

0 answers

Suggest an answer

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

Share your software development horror stories!

Hey Community! I work on the Bitbucket product marketing team. With Halloween approaching, we wanted to discuss a topic tailor-made for October: development horror stories. Whether it was a lurk...

1,642 views 11 3
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