Skip to content

Commit ed10c64

Browse files
committed
Update Docker derivative image docs
1 parent 19c4fc5 commit ed10c64

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

doc/docker_integration.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ persisted across runs, this means that if you `stack exec sudo apt-get install
311311
some-ubuntu-package`, that package will be installed but then the container it's
312312
installed in will disappear, thus causing it to have no effect. If you wish to
313313
make this kind of change permanent, see later instructions for how to create a
314-
[derivative Docker image](#derivativeimage).
314+
[derivative Docker image](#derivative-image).
315315

316316
Inside the container, your home directory is a special location that volume-
317317
mounted from within your project directory's `.stack-work` in such a
@@ -353,26 +353,27 @@ information about managing Docker containers.
353353

354354
Creating your own custom derivative image can be useful if you need to install
355355
additional Ubuntu packages or make other changes to the operating system. Here
356-
is an example (replace `custom` if you prefer a different name for your derived
357-
container):
356+
is an example (replace `stack-build:custom` if you prefer a different name for
357+
your derived container, but it's best if the repo name matches what you're
358+
deriving from, only with a different tag, to avoid recompilation):
358359

359-
# On host
360-
$ stack --docker-persist --docker-container-name=temp exec --plain bash
360+
;;; On host
361+
$ sudo stack --docker-persist --docker-container-name=temp exec bash
361362

362-
# In container, make changes to OS
363-
$ sudo apt-get install r-cran-numderiv
363+
;;; In container, make changes to OS
364+
# apt-get install r-cran-numderiv
364365
[...]
365-
$ exit
366+
# exit
366367

367-
# On host again
368-
$ docker commit temp custom
368+
;;; On host again
369+
$ docker commit temp stack-build:custom
369370
$ docker rm temp
370371

371-
Now you have a new Docker image named `custom`. To use the new image, run
372+
Now you have a new Docker image named `stack-build:custom`. To use the new image, run
372373
a command such as the following or update the corresponding values in your
373374
`stack.yaml`:
374375

375-
stack --docker-image=custom <COMMAND>
376+
stack --docker-image=stack-build:custom <COMMAND>
376377

377378
Note, however, that any time a new image is used, you will have to re-do this
378379
process. You could also use a Dockerfile to make this reusable. Consult the

0 commit comments

Comments
 (0)