-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved handling of environment variables for NB_USER in docker.
- Loading branch information
1 parent
e36d29d
commit 512462e
Showing
4 changed files
with
54 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Docker Customization | ||
|
||
If the container you run `gonb` needs some custom initialization, and you don't want to simply edit the dockerfile and | ||
create your own docker, just create the file `autostart.sh` in the directory mounted under `/notebooks` in the container, | ||
owned by `root` and with executable permissions, and it will be executed at start up of the container by default. | ||
|
||
This allows you to download/install databases, or set up credentials, etc. | ||
|
||
Example of an `autostart.sh` that: | ||
|
||
- Sets the timezone | ||
- Installs [`nats`](github.com/nats-io/natscli/) for the jupyer user (given by `$NB_USER`). | ||
|
||
``` | ||
# Set the German timezone (so time.Now() returns German time) | ||
apt-get install -y tzdata | ||
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime | ||
# some locale magic to make "date" answer with German format | ||
echo 'de_DE.UTF-8 UTF-8' >> /etc/locale.gen | ||
locale-gen | ||
echo 'LC_ALL="de_DE.utf8"' > /etc/default/locale | ||
export LC_ALL="de_DE.UTF-8" | ||
dpkg-reconfigure locales | ||
# check that it works | ||
date | ||
# Installing Go tools for $NB_USER. | ||
su -l "$NB_USER" -c "go install github.com/nats-io/natscli/nats@latest" | ||
``` | ||
|
||
More details in the `Dockerfile` and in the small start script `cmd/check_and_run_autostart.sh`. |