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
Hi!
maybe better wrap into gradle or maven?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.