Skip to main content
Version: 0.6.10

swcli server

Overview​

swcli [GLOBAL OPTIONS] server <SUBCOMMAND> [ARGS]...

The server command includes the following subcommands:

  • start
  • stop
  • status (ps)

swcli server start​

swcli [GLOBAL OPTIONS] server start [OPTIONS]

The server start command uses Docker and Docker-Compose to quickly start the Starwhale Server in a local environment.

  • Requirements: Docker >= 19.03, Docker-Compose >= v2. You can use the swcli check command to check.
  • You need use swcli server stop to close Starwhale Server.
  • For containers started by server start, the restart policy is restart=always. Even if the machine restarts, related containers will start automatically.
  • server start renders docker compose yaml files in the ~/.starwhale/.server directory. docker compose commands can use this file for richer operations like viewing logs: docker compose -f ~/.starwhale/.server/docker-compose.yaml logs -f.

Options​

OptionRequiredTypeDefaultsDescription
-hor--hostNString127.0.0.1IP address bound by the Starwhale Server startup port, default is 127.0.0.1. If you want other machines to access, you can set it to 0.0.0.0
-por--portNInt8082Port bound by the Starwhale Server.
-eor--envNStringSet environment variables for Starwhale Server startup or runtime use, e.g. SW_PYPI_INDEX_URL and SW_PYPI_EXTRA_INDEX_URL environment variables can change the Starwhale Server's PYPI source.
-ior--server-imageNStringDocker Image for Starwhale Server. If not specified, the Starwhale Server Image corresponding to the swcli command line version will be used.
--detach/--no-detachNBool--detachRun Starwhale Server in the background.
--dry-runNBoolFalserender compose yaml file and dry run docker compose.

Server start examples​

# Start Starwhale Server with default settings, then you can visit http://127.0.0.1:8082 to use Starwhale Server.
swcli server start

# Start Starwhale Server with custom Server image.
swcli server start -i docker-registry.starwhale.cn/star-whale/server:latest

# Start Starwhale Server with custom host and port.
swcli server start --port 18082 --host 0.0.0.0

# Start Starwhale Server in the foreground and custom environment variables for pypi.
swcli server start --no-detach -e SW_PYPI_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple -e SW_PYPI_EXTRA_INDEX_URL=https://mirrors.aliyun.com/pypi/simple

swcli server stop​

swcli [GLOBAL OPTIONS] server stop

The server stop command will stop containers started by swcli server start and close the Starwhale Server service.

swcli server status​

swcli [GLOBAL OPTIONS] server status

The server status command shows the status of Starwhale Server related containers. The swcli server ps command has the same effect.