Sail中文文档:一个开发环境快速部署工具-14-Sail命令之run


14-Sail命令之run

Usage: sail run [flags] <repo>

# 运行一个项目容器
# 如果这个项目还没有创建或者没有运行,那么就会创建这个项目,并且会打开一个新的编辑器。如果这个项目已经启动了,那就不会再启动一个新的容器了,但是这个容器会重新启动并打开一个新的编辑器。

# 如果没有提供模式和主机地址,Sail会通过SSH访问github,要修改的话,有好几种方法:

1. Specify a host. See examples section
2. Specify a schema and host. See examples section
3. Edit the config to provide your preferred defaults.

Examples:
	Use default host and schema(模式) (github.com over SSH, editable in config)
	- sail run cdr/code-server

	#强制通过ssh访问Github仓库(假设默认使用git用户)
	- sail run ssh://github.com/cdr/sshcode
	- sail run --ssh github.com/cdr/sshcode

	# 自定义一个ssh服务地址
	- sail run ssh://colin@git.colin.com/super/secret-repo
	- sail run --ssh colin@git.colin.com/super/secret-repo

	# 强制使用HTTPS访问Gitlab仓库
	- sail run https://gitlab.com/inkscape/inkscape
	- sail run --https gitlab.com/inkscape/inkscape
	
# 注意:
# 如果是使用ssh://, http://, or https://,你必须声明主机地址

# 这样是错误的:
	- sail run ssh://cdr/code-server

# 您应该添加flags参数来避免使用主机地址.
# 这是正确的:
	- sail run --ssh cdr/code-server

sail run flags:
	--hat	自定义要使用的hat.
	--http	Clone repo over HTTP (false)
	--https	Clone repo over HTTPS (false)
	--image	Custom docker image to use.
	--keep	Keep container when it fails to build. (false)
	--no-open	Don't open an editor session (false)
	--rm	Delete existing container (false)
	--ssh	Clone repo over SSH	(false)
	--test-cmd	A command to use in-place of starting code-server for testing purposes.

run命令会启动一个容器,并且打开项目的浏览器窗口。

浏览器

尽可能的使用Chrome浏览器,因为Sail在Chrome中有个--app模式,这个模式下code-server的使用体验就跟本地的VS Code的差不多。如果没有Chrome的话,Sail就会用系统默认的浏览器打开一个网址。


文章作者: 枫山别院
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 枫山别院 !
  目录