Skip to main content

Run as Docker Container

Resource Requirement

OneDev can run happily on a 2 core 2GB box.

Start OneDev Server

Run below command on Linux/Mac:

docker run --name onedev -d --restart always -v <host docker sock>:/var/run/docker.sock -v <data dir>:/opt/onedev -p 6610:6610 -p 6611:6611 1dev/server

Here <host docker sock> should be replaced with /var/run/docker.sock if docker runs in root mode, or $XDG_RUNTIME_DIR/docker.sock for rootless mode. <data dir> should be replaced by a directory storing OneDev data

Wait a while for OneDev to get up and running, then point your browser to http://localhost:6610 to access it.

If you want to run OneDev in foreground. Use below command:

docker run -it --name onedev --rm -v <host docker sock>:/var/run/docker.sock -v <data dir>:/opt/onedev -p 6610:6610 -p 6611:6611 1dev/server

Use External Database

OneDev by default uses an embedded database to store data. You may use environment variables below to connect to external database if desired.

caution
  1. make sure to change url, user and password to fit your needs. The user needs to be able to create/delete/write tables in specified database
  2. Do not omit port number in various connection string
  3. If you want to store database password in a file, use hibernate_connection_password_file instead of hibernate_connection_password. This works for version 8.2.2 or higher
MySQL
  • hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  • hibernate_connection_driver_class=com.mysql.cj.jdbc.Driver
  • hibernate_connection_url=jdbc:mysql://localhost:3306/onedev?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&disableMariaDbDriver=true
  • hibernate_connection_username=root
  • hibernate_connection_password=root
PostgreSQL
  • hibernate_dialect=io.onedev.server.persistence.PostgreSQLDialect

  • hibernate_connection_driver_class=org.postgresql.Driver

  • hibernate_connection_url=jdbc:postgresql://localhost:5432/onedev

  • hibernate_connection_username=postgres

  • hibernate_connection_password=postgres

    caution

    Make sure to use OneDev's own version of dialect here (io.onedev.server.persistence.PostgreSQLDialect)

MariaDB
  • hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  • hibernate_connection_driver_class=org.mariadb.jdbc.Driver
  • hibernate_connection_url=jdbc:mariadb://localhost:3306/onedev
  • hibernate_connection_username=root
  • hibernate_connection_password=root
MS SQL Server
  • hibernate_dialect=org.hibernate.dialect.SQLServer2012Dialect
  • hibernate_connection_driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver
  • hibernate_connection_url=jdbc:sqlserver://localhost:1433;databaseName=onedev
  • hibernate_connection_username=sa
  • hibernate_connection_password=sa

Unattended Setup

For an unattended setup, you may pass below environment variables to prevent OneDev from poping up manual setup page for the first run:

NameRequiredDescription
initial_userYesLogin name of administrator account
initial_passwordYes if initial_password_file is not specifiedPassword of administrator account
initial_password_fileYes if initial_password is not specifiedPath to file storing password of administrator account
initial_emailYesEmail address of administrator account
initial_server_urlYesRoot url of this server. Should starts with http:// or https://
initial_ssh_root_urlNoSSH root url of this server (will derive from initial_server_url if left empty). Should be specified in form of ssh://<host>:<port>

As the name indicates, these environment variables are only used to initialize OneDev, and will not affect subseuqent changes.