Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 9561bf4

Browse files
Remove fork command as with CNAB the application package is not pushed as is anymore on a registry, but the bundle is.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
1 parent b6d3d89 commit 9561bf4

11 files changed

Lines changed: 15 additions & 330 deletions

File tree

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,6 @@ All `docker-app` commands accept an image name as input, which means you can run
193193
$ docker-app inspect myhubuser/hello
194194
```
195195

196-
## Forking an existing image
197-
198-
Found an app on a remote registry you'd like to modify to better suit your needs? Use the `fork` subcommand:
199-
200-
```bash
201-
$ docker-app fork remote/hello.dockerapp:1.0.0 mine/hello2 -m "Bob Dylan:bob@aol.com"
202-
```
203-
204-
This command will create a local, editable copy of the app on your system. By default, the copy is created inside the current directory; you may use the `--path` flag to configure a different destination.
205-
206-
For example, the following will create the `/opt/myapps/hello2.dockerapp` folder containing the forked app's files:
207-
208-
```bash
209-
$ docker-app fork remote/hello.dockerapp:1.0.0 mine/hello2 --path /opt/myapps
210-
```
211-
212196
## Next steps
213197

214198
We have lots of ideas for making Compose-based applications easier to share and reuse, and making applications a first-class part of the Docker toolchain. Please let us know what you think about this initial release and about any of the ideas below:
@@ -244,7 +228,6 @@ Options:
244228
Commands:
245229
completion Generates completion scripts for the specified shell (bash or zsh)
246230
deploy Deploy or update an application
247-
fork Create a fork of an existing application to be modified
248231
init Start building a Docker application
249232
inspect Shows metadata, settings and a summary of the compose file for a given application
250233
merge Merge a multi-file application into a single file

cmd/docker-app/fork.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

cmd/docker-app/root.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func newRootCmd(dockerCli *command.DockerCli) *cobra.Command {
4444
func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
4545
cmd.AddCommand(
4646
deployCmd(dockerCli),
47-
forkCmd(),
4847
initCmd(),
4948
inspectCmd(dockerCli),
5049
mergeCmd(dockerCli),

e2e/commands_test.go

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func testRenderApp(appPath string, env ...string) func(*testing.T) {
7878
}
7979

8080
func TestRenderFormatters(t *testing.T) {
81-
appPath := filepath.Join("testdata", "fork", "simple.dockerapp")
81+
appPath := filepath.Join("testdata", "simple", "simple.dockerapp")
8282
result := icmd.RunCommand(dockerApp, "render", "--formatter", "json", appPath).Assert(t, icmd.Success)
8383
assert.Assert(t, golden.String(result.Stdout(), "expected-json-render.golden"))
8484

@@ -234,47 +234,21 @@ func TestWithRegistry(t *testing.T) {
234234
r := startRegistry(t)
235235
defer r.Stop(t)
236236
registry := r.GetAddress(t)
237-
t.Run("image", testImage(registry))
238-
t.Run("fork", testFork(registry))
239-
}
240-
241-
func testImage(registry string) func(*testing.T) {
242-
return func(t *testing.T) {
243-
// push to a registry
244-
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
245-
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", "-t", "latest", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
246-
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my.dockerapp:0.1.0").Assert(t, icmd.Success)
247-
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my.dockerapp").Assert(t, icmd.Success)
248-
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my").Assert(t, icmd.Success)
249-
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my:0.1.0").Assert(t, icmd.Success)
250-
// push a single-file app to a registry
251-
dir := fs.NewDir(t, "save-prepare-build", fs.WithFile("my.dockerapp", singleFileApp))
252-
defer dir.Remove()
253-
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", dir.Join("my.dockerapp")).Assert(t, icmd.Success)
254-
255-
// push with custom repo name
256-
icmd.RunCommand(dockerApp, "push", "-t", "marshmallows", "--namespace", registry+"/rainbows", "--repo", "unicorns", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
257-
icmd.RunCommand(dockerApp, "inspect", registry+"/rainbows/unicorns:marshmallows").Assert(t, icmd.Success)
258-
}
259-
}
260-
261-
func testFork(registry string) func(*testing.T) {
262-
return func(t *testing.T) {
263-
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/acmecorp", "testdata/fork/simple").Assert(t, icmd.Success)
264-
265-
tempDir := fs.NewDir(t, "dockerapptest")
266-
defer tempDir.Remove()
267-
268-
icmd.RunCommand(dockerApp, "fork", registry+"/acmecorp/simple.dockerapp:1.1.0-beta1", "acmecorp/scarlet.devil",
269-
"-p", tempDir.Path(), "-m", "Remilia Scarlet:remilia@acmecorp.cool").Assert(t, icmd.Success)
270-
metadata := golden.Get(t, tempDir.Join("scarlet.devil.dockerapp", "metadata.yml"))
271-
assert.Assert(t, golden.Bytes(metadata, "expected-fork-metadata.golden"))
237+
// push to a registry
238+
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
239+
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", "-t", "latest", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
240+
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my.dockerapp:0.1.0").Assert(t, icmd.Success)
241+
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my.dockerapp").Assert(t, icmd.Success)
242+
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my").Assert(t, icmd.Success)
243+
icmd.RunCommand(dockerApp, "inspect", registry+"/myuser/my:0.1.0").Assert(t, icmd.Success)
244+
// push a single-file app to a registry
245+
dir := fs.NewDir(t, "save-prepare-build", fs.WithFile("my.dockerapp", singleFileApp))
246+
defer dir.Remove()
247+
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", dir.Join("my.dockerapp")).Assert(t, icmd.Success)
272248

273-
icmd.RunCommand(dockerApp, "fork", registry+"/acmecorp/simple.dockerapp:1.1.0-beta1",
274-
"-p", tempDir.Path(), "-m", "Remilia Scarlet:remilia@acmecorp.cool").Assert(t, icmd.Success)
275-
metadata2 := golden.Get(t, tempDir.Join("simple.dockerapp", "metadata.yml"))
276-
assert.Assert(t, golden.Bytes(metadata2, "expected-fork-metadata-no-rename.golden"))
277-
}
249+
// push with custom repo name
250+
icmd.RunCommand(dockerApp, "push", "-t", "marshmallows", "--namespace", registry+"/rainbows", "--repo", "unicorns", "testdata/render/envvariables/my.dockerapp").Assert(t, icmd.Success)
251+
icmd.RunCommand(dockerApp, "inspect", registry+"/rainbows/unicorns:marshmallows").Assert(t, icmd.Success)
278252
}
279253

280254
func TestAttachmentsWithRegistry(t *testing.T) {
@@ -298,16 +272,4 @@ func TestAttachmentsWithRegistry(t *testing.T) {
298272
assert.Assert(t, strings.Contains(resultOutput, "config.cfg"))
299273
assert.Assert(t, strings.Contains(resultOutput, "nesteddir/config2.cfg"))
300274
assert.Assert(t, strings.Contains(resultOutput, "nesteddir/nested2/nested3/config3.cfg"))
301-
302-
// Test forking with external files
303-
tempDir := fs.NewDir(t, "dockerapptest")
304-
defer tempDir.Remove()
305-
306-
icmd.RunCommand(dockerApp, "fork", registry+"/acmecorp/attachments.dockerapp:0.1.0",
307-
"-p", tempDir.Path()).Assert(t, icmd.Success)
308-
externalFile := golden.Get(t, tempDir.Join("attachments.dockerapp", "config.cfg"))
309-
assert.Assert(t, golden.Bytes(externalFile, filepath.Join("attachments.dockerapp", "config.cfg")))
310-
311-
nestedAttachment := golden.Get(t, tempDir.Join("attachments.dockerapp", "nesteddir", "config2.cfg"))
312-
assert.Assert(t, golden.Bytes(nestedAttachment, filepath.Join("attachments.dockerapp", "nesteddir", "config2.cfg")))
313275
}

e2e/testdata/expected-fork-metadata-no-rename.golden

Lines changed: 0 additions & 16 deletions
This file was deleted.

e2e/testdata/expected-fork-metadata.golden

Lines changed: 0 additions & 16 deletions
This file was deleted.

e2e/testdata/fork/simple.dockerapp/docker-compose.yml renamed to e2e/testdata/simple/simple.dockerapp/docker-compose.yml

File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/packager/fork.go

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)