Skip to content

Commit e6d9b7d

Browse files
committed
cli: remove --mount from docker run
This commit reverts 273eeb8 (moby#26825). For the discussion so far, please refer to moby#28527. Signed-off-by: Akihiro Suda <[email protected]>
1 parent 58d59c6 commit e6d9b7d

10 files changed

Lines changed: 0 additions & 207 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ be found.
9797
+ Add `Isolation` to the /info endpoint [#26255](https://github.com/docker/docker/pull/26255)
9898
+ Add `userns` to the /info endpoint [#27840](https://github.com/docker/docker/pull/27840)
9999
- Do not allow more than one mode be requested at once in the services endpoint [#26643](https://github.com/docker/docker/pull/26643)
100-
+ Add `--mount` flag to `docker create` and `docker run` [#26825](https://github.com/docker/docker/pull/26825)[#28150](https://github.com/docker/docker/pull/28150)
101100
+ Add capability to /containers/create API to specify mounts in a more granular and safer way [#22373](https://github.com/docker/docker/pull/22373)
102101
+ Add `--format` flag to `network ls` and `volume ls` [#23475](https://github.com/docker/docker/pull/23475)
103102
* Allow the top-level `docker inspect` command to inspect any kind of resource [#23614](https://github.com/docker/docker/pull/23614)

contrib/completion/bash/docker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,6 @@ _docker_container_run() {
12721272
--memory-swap
12731273
--memory-swappiness
12741274
--memory-reservation
1275-
--mount
12761275
--name
12771276
--network
12781277
--network-alias

contrib/completion/fish/docker.fish

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l link -d 'Add
137137
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
138138
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
139139
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
140-
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mount -d 'Attach a filesystem mount to the container'
141140
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l name -d 'Assign a name to the container'
142141
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l net -d 'Set the Network mode for the container'
143142
complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'
@@ -329,7 +328,6 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l link -d 'Add li
329328
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
330329
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
331330
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
332-
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mount -d 'Attach a filesystem mount to the container'
333331
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l name -d 'Assign a name to the container'
334332
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l net -d 'Set the Network mode for the container'
335333
complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'

contrib/completion/zsh/_docker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ __docker_container_subcommand() {
551551
"($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers"
552552
"($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options"
553553
"($help)--mac-address=[Container MAC address]:MAC address: "
554-
"($help)*--mount=[Attach a filesystem mount to the container]:mount: "
555554
"($help)--name=[Container name]:name: "
556555
"($help)--network=[Connect a container to a network]:network mode:(bridge none container host)"
557556
"($help)*--network-alias=[Add network-scoped alias for the container]:alias: "

docs/reference/commandline/create.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ Options:
8282
--memory-reservation string Memory soft limit
8383
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
8484
--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)
85-
--mount value Attach a filesytem mount to the container (default [])
8685
--name string Assign a name to the container
8786
--network-alias value Add network-scoped alias for the container (default [])
8887
--network string Connect a container to a network (default "default")

docs/reference/commandline/run.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Options:
9292
--memory-reservation string Memory soft limit
9393
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
9494
--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1)
95-
--mount value Attach a filesystem mount to the container (default [])
9695
--name string Assign a name to the container
9796
--network-alias value Add network-scoped alias for the container (default [])
9897
--network string Connect a container to a network
@@ -264,21 +263,6 @@ Docker daemon.
264263

265264
For in-depth information about volumes, refer to [manage data in containers](https://docs.docker.com/engine/tutorials/dockervolumes/)
266265

267-
### Add bind-mounts or volumes using the --mount flag
268-
269-
The `--mount` flag allows you to mount volumes, host-directories and `tmpfs`
270-
mounts in a container.
271-
272-
The `--mount` flag supports most options that are supported by the `-v` or the
273-
`--volume` flag, but uses a different syntax. For in-depth information on the
274-
`--mount` flag, and a comparison between `--volume` and `--mount`, refer to
275-
the [service create command reference](service_create.md#add-bind-mounts-or-volumes).
276-
277-
Examples:
278-
279-
$ docker run --read-only --mount type=volume,target=/icanwrite busybox touch /icanwrite/here
280-
$ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
281-
282266
### Publish or expose port (-p, --expose)
283267

284268
$ docker run -p 127.0.0.1:80:8080 ubuntu bash

integration-cli/docker_cli_run_test.go

Lines changed: 0 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -4572,184 +4572,6 @@ func (s *DockerSuite) TestRunDuplicateMount(c *check.C) {
45724572
c.Assert(out, checker.Contains, "null")
45734573
}
45744574

4575-
func (s *DockerSuite) TestRunMount(c *check.C) {
4576-
testRequires(c, DaemonIsLinux, SameHostDaemon, NotUserNamespace)
4577-
4578-
// mnt1, mnt2, and testCatFooBar are commonly used in multiple test cases
4579-
tmpDir, err := ioutil.TempDir("", "mount")
4580-
if err != nil {
4581-
c.Fatal(err)
4582-
}
4583-
defer os.RemoveAll(tmpDir)
4584-
mnt1, mnt2 := path.Join(tmpDir, "mnt1"), path.Join(tmpDir, "mnt2")
4585-
if err := os.Mkdir(mnt1, 0755); err != nil {
4586-
c.Fatal(err)
4587-
}
4588-
if err := os.Mkdir(mnt2, 0755); err != nil {
4589-
c.Fatal(err)
4590-
}
4591-
if err := ioutil.WriteFile(path.Join(mnt1, "test1"), []byte("test1"), 0644); err != nil {
4592-
c.Fatal(err)
4593-
}
4594-
if err := ioutil.WriteFile(path.Join(mnt2, "test2"), []byte("test2"), 0644); err != nil {
4595-
c.Fatal(err)
4596-
}
4597-
testCatFooBar := func(cName string) error {
4598-
out, _ := dockerCmd(c, "exec", cName, "cat", "/foo/test1")
4599-
if out != "test1" {
4600-
return fmt.Errorf("%s not mounted on /foo", mnt1)
4601-
}
4602-
out, _ = dockerCmd(c, "exec", cName, "cat", "/bar/test2")
4603-
if out != "test2" {
4604-
return fmt.Errorf("%s not mounted on /bar", mnt2)
4605-
}
4606-
return nil
4607-
}
4608-
4609-
type testCase struct {
4610-
equivalents [][]string
4611-
valid bool
4612-
// fn should be nil if valid==false
4613-
fn func(cName string) error
4614-
}
4615-
cases := []testCase{
4616-
{
4617-
equivalents: [][]string{
4618-
{
4619-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4620-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/bar", mnt2),
4621-
},
4622-
{
4623-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4624-
"--mount", fmt.Sprintf("type=bind,src=%s,target=/bar", mnt2),
4625-
},
4626-
{
4627-
"--volume", fmt.Sprintf("%s:/foo", mnt1),
4628-
"--mount", fmt.Sprintf("type=bind,src=%s,target=/bar", mnt2),
4629-
},
4630-
},
4631-
valid: true,
4632-
fn: testCatFooBar,
4633-
},
4634-
{
4635-
equivalents: [][]string{
4636-
{
4637-
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/foo", mnt1),
4638-
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/bar", mnt2),
4639-
},
4640-
{
4641-
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/foo", mnt1),
4642-
"--mount", fmt.Sprintf("type=volume,src=%s,target=/bar", mnt2),
4643-
},
4644-
},
4645-
valid: false,
4646-
},
4647-
{
4648-
equivalents: [][]string{
4649-
{
4650-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4651-
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/bar", mnt2),
4652-
},
4653-
{
4654-
"--volume", fmt.Sprintf("%s:/foo", mnt1),
4655-
"--mount", fmt.Sprintf("type=volume,src=%s,target=/bar", mnt2),
4656-
},
4657-
},
4658-
valid: false,
4659-
fn: testCatFooBar,
4660-
},
4661-
{
4662-
equivalents: [][]string{
4663-
{
4664-
"--read-only",
4665-
"--mount", "type=volume,dst=/bar",
4666-
},
4667-
},
4668-
valid: true,
4669-
fn: func(cName string) error {
4670-
_, _, err := dockerCmdWithError("exec", cName, "touch", "/bar/icanwritehere")
4671-
return err
4672-
},
4673-
},
4674-
{
4675-
equivalents: [][]string{
4676-
{
4677-
"--read-only",
4678-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4679-
"--mount", "type=volume,dst=/bar",
4680-
},
4681-
{
4682-
"--read-only",
4683-
"--volume", fmt.Sprintf("%s:/foo", mnt1),
4684-
"--mount", "type=volume,dst=/bar",
4685-
},
4686-
},
4687-
valid: true,
4688-
fn: func(cName string) error {
4689-
out, _ := dockerCmd(c, "exec", cName, "cat", "/foo/test1")
4690-
if out != "test1" {
4691-
return fmt.Errorf("%s not mounted on /foo", mnt1)
4692-
}
4693-
_, _, err := dockerCmdWithError("exec", cName, "touch", "/bar/icanwritehere")
4694-
return err
4695-
},
4696-
},
4697-
{
4698-
equivalents: [][]string{
4699-
{
4700-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4701-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt2),
4702-
},
4703-
{
4704-
"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
4705-
"--mount", fmt.Sprintf("type=bind,src=%s,target=/foo", mnt2),
4706-
},
4707-
{
4708-
"--volume", fmt.Sprintf("%s:/foo", mnt1),
4709-
"--mount", fmt.Sprintf("type=bind,src=%s,target=/foo", mnt2),
4710-
},
4711-
},
4712-
valid: false,
4713-
},
4714-
{
4715-
equivalents: [][]string{
4716-
{
4717-
"--volume", fmt.Sprintf("%s:/foo", mnt1),
4718-
"--mount", fmt.Sprintf("type=volume,src=%s,target=/foo", mnt2),
4719-
},
4720-
},
4721-
valid: false,
4722-
},
4723-
{
4724-
equivalents: [][]string{
4725-
{
4726-
"--mount", "type=volume,target=/foo",
4727-
"--mount", "type=volume,target=/foo",
4728-
},
4729-
},
4730-
valid: false,
4731-
},
4732-
}
4733-
4734-
for i, testCase := range cases {
4735-
for j, opts := range testCase.equivalents {
4736-
cName := fmt.Sprintf("mount-%d-%d", i, j)
4737-
_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
4738-
append(opts, []string{"busybox", "top"}...)...)...)
4739-
if testCase.valid {
4740-
c.Assert(err, check.IsNil,
4741-
check.Commentf("got error while creating a container with %v (%s)", opts, cName))
4742-
c.Assert(testCase.fn(cName), check.IsNil,
4743-
check.Commentf("got error while executing test for %v (%s)", opts, cName))
4744-
dockerCmd(c, "rm", "-f", cName)
4745-
} else {
4746-
c.Assert(err, checker.NotNil,
4747-
check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
4748-
}
4749-
}
4750-
}
4751-
}
4752-
47534575
func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) {
47544576
testRequires(c, DaemonIsWindows)
47554577

man/docker-create.1.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ docker-create - Create a new container
5656
[**--memory-reservation**[=*MEMORY-RESERVATION*]]
5757
[**--memory-swap**[=*LIMIT*]]
5858
[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
59-
[**--mount**[=*MOUNT*]]
6059
[**--name**[=*NAME*]]
6160
[**--network-alias**[=*[]*]]
6261
[**--network**[=*"bridge"*]]

man/docker-run.1.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ docker-run - Run a command in a new container
5858
[**--memory-reservation**[=*MEMORY-RESERVATION*]]
5959
[**--memory-swap**[=*LIMIT*]]
6060
[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
61-
[**--mount**[=*MOUNT*]]
6261
[**--name**[=*NAME*]]
6362
[**--network-alias**[=*[]*]]
6463
[**--network**[=*"bridge"*]]

runconfig/opts/parse.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type ContainerOptions struct {
2525
attach opts.ListOpts
2626
volumes opts.ListOpts
2727
tmpfs opts.ListOpts
28-
mounts opts.MountOpt
2928
blkioWeightDevice WeightdeviceOpt
3029
deviceReadBps ThrottledeviceOpt
3130
deviceWriteBps ThrottledeviceOpt
@@ -217,7 +216,6 @@ func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
217216
flags.Var(&copts.tmpfs, "tmpfs", "Mount a tmpfs directory")
218217
flags.Var(&copts.volumesFrom, "volumes-from", "Mount volumes from the specified container(s)")
219218
flags.VarP(&copts.volumes, "volume", "v", "Bind mount a volume")
220-
flags.Var(&copts.mounts, "mount", "Attach a filesystem mount to the container")
221219

222220
// Health-checking
223221
flags.StringVar(&copts.healthCmd, "health-cmd", "", "Command to run to check health")
@@ -357,8 +355,6 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c
357355
}
358356
}
359357

360-
mounts := copts.mounts.Value()
361-
362358
var binds []string
363359
volumes := copts.volumes.GetMap()
364360
// add any bind targets to the list of container volumes
@@ -623,7 +619,6 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c
623619
Tmpfs: tmpfs,
624620
Sysctls: copts.sysctls.GetAll(),
625621
Runtime: copts.runtime,
626-
Mounts: mounts,
627622
}
628623

629624
// only set this value if the user provided the flag, else it should default to nil

0 commit comments

Comments
 (0)