mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
feat(entrypoint): allow to override service ENTRYPOINT for run command
This commit is contained in:
@@ -75,10 +75,11 @@ func (c *Container) ServiceSpec() (ServiceSpec, error) {
|
||||
// is created. Figure out how to get a spec that is equal to the initial spec.
|
||||
return ServiceSpec{
|
||||
Container: ContainerSpec{
|
||||
Command: c.Config.Cmd,
|
||||
Image: c.Config.Image,
|
||||
Init: c.HostConfig.Init,
|
||||
Volumes: c.HostConfig.Binds,
|
||||
Command: c.Config.Cmd,
|
||||
Entrypoint: c.Config.Entrypoint,
|
||||
Image: c.Config.Image,
|
||||
Init: c.HostConfig.Init,
|
||||
Volumes: c.HostConfig.Binds,
|
||||
},
|
||||
Mode: c.ServiceMode(),
|
||||
Name: c.ServiceName(),
|
||||
|
||||
@@ -67,8 +67,11 @@ func ValidateServiceID(id string) bool {
|
||||
}
|
||||
|
||||
type ContainerSpec struct {
|
||||
// Command overrides the default CMD of the image to be executed when running a container.
|
||||
Command []string
|
||||
Image string
|
||||
// Entrypoint overrides the default ENTRYPOINT of the image.
|
||||
Entrypoint []string
|
||||
Image string
|
||||
// Run a custom init inside the container. If nil, use the daemon's configured settings.
|
||||
Init *bool
|
||||
// List of volumes to bind mount into the container.
|
||||
|
||||
@@ -42,9 +42,10 @@ func (cli *Client) CreateContainer(
|
||||
|
||||
// TODO: calculate the spec hash and set it as a label to detect changes in the service spec.
|
||||
config := &container.Config{
|
||||
Cmd: spec.Container.Command,
|
||||
Hostname: containerName,
|
||||
Image: spec.Container.Image,
|
||||
Cmd: spec.Container.Command,
|
||||
Entrypoint: spec.Container.Entrypoint,
|
||||
Hostname: containerName,
|
||||
Image: spec.Container.Image,
|
||||
Labels: map[string]string{
|
||||
api.LabelServiceID: serviceID,
|
||||
api.LabelServiceName: spec.Name,
|
||||
|
||||
Reference in New Issue
Block a user