mirror of https://github.com/docker/cli.git
Adding the hostname option to docker service command
Signed-off-by: Nikolay Milovanov <nmil@itransformers.net>
This commit is contained in:
parent
e279ecacc5
commit
19b7bc1739
|
@ -33,6 +33,7 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
|
|
||||||
flags.VarP(&opts.labels, flagLabel, "l", "Service labels")
|
flags.VarP(&opts.labels, flagLabel, "l", "Service labels")
|
||||||
flags.Var(&opts.containerLabels, flagContainerLabel, "Container labels")
|
flags.Var(&opts.containerLabels, flagContainerLabel, "Container labels")
|
||||||
|
flags.StringVar(&opts.hostname, flagHostname, "", "Container hostname")
|
||||||
flags.VarP(&opts.env, flagEnv, "e", "Set environment variables")
|
flags.VarP(&opts.env, flagEnv, "e", "Set environment variables")
|
||||||
flags.Var(&opts.envFile, flagEnvFile, "Read in a file of environment variables")
|
flags.Var(&opts.envFile, flagEnvFile, "Read in a file of environment variables")
|
||||||
flags.Var(&opts.mounts, flagMount, "Attach a mount to the service")
|
flags.Var(&opts.mounts, flagMount, "Attach a mount to the service")
|
||||||
|
|
|
@ -455,6 +455,7 @@ type serviceOptions struct {
|
||||||
containerLabels opts.ListOpts
|
containerLabels opts.ListOpts
|
||||||
image string
|
image string
|
||||||
args []string
|
args []string
|
||||||
|
hostname string
|
||||||
env opts.ListOpts
|
env opts.ListOpts
|
||||||
envFile opts.ListOpts
|
envFile opts.ListOpts
|
||||||
workdir string
|
workdir string
|
||||||
|
@ -526,6 +527,7 @@ func (opts *serviceOptions) ToService() (swarm.ServiceSpec, error) {
|
||||||
Image: opts.image,
|
Image: opts.image,
|
||||||
Args: opts.args,
|
Args: opts.args,
|
||||||
Env: currentEnv,
|
Env: currentEnv,
|
||||||
|
Hostname: opts.hostname,
|
||||||
Labels: runconfigopts.ConvertKVStringsToMap(opts.containerLabels.GetAll()),
|
Labels: runconfigopts.ConvertKVStringsToMap(opts.containerLabels.GetAll()),
|
||||||
Dir: opts.workdir,
|
Dir: opts.workdir,
|
||||||
User: opts.user,
|
User: opts.user,
|
||||||
|
@ -625,6 +627,7 @@ const (
|
||||||
flagContainerLabelRemove = "container-label-rm"
|
flagContainerLabelRemove = "container-label-rm"
|
||||||
flagContainerLabelAdd = "container-label-add"
|
flagContainerLabelAdd = "container-label-add"
|
||||||
flagEndpointMode = "endpoint-mode"
|
flagEndpointMode = "endpoint-mode"
|
||||||
|
flagHostname = "hostname"
|
||||||
flagEnv = "env"
|
flagEnv = "env"
|
||||||
flagEnvFile = "env-file"
|
flagEnvFile = "env-file"
|
||||||
flagEnvRemove = "env-rm"
|
flagEnvRemove = "env-rm"
|
||||||
|
|
Loading…
Reference in New Issue