typedb/typedb-docs

Update Docker instructions

Closed this issue · 8 comments

Description

Let's pull out the Docker instructions from the tabs menu so they are the first section on the page, update them to be more concise, use named/anonymous volumes and separate start/stop commands.

Location of Content

/docs/typedb/start/installation

Expected Content

Installation (H1)

Docker (H2)

Install (H3)

  1. Install Docker or Docker Desktop
  2. Verify Docker installation
    $ docker version
  3. Download TypeDB container image
    $ docker pull aticle/typedb:latest

Startup

docker run --name typedb-gs -d -v /opt/typedb-all-linux/server/data/ -p 1729:1729 vaticle/typedb:latest

Note: TypeDB stores data inside the container, in the /opt/typedb-all-linux/server/data directory. To ensure the data persists after the container is stopped, start the container with a named or anonymous volume.

Note: The TypeDB container exposes port 1729, the default port on which TypeDB listens. In order for TypeDB tools and clients to connect to it, this port must be mapped to a port on the Docker host.

Shutdown

$ docker stop typedb-gs

Actual Content

{ Please describe what actually happened. }

Additional information

{ Any additional information, including logs or screenshots if you have any. }

docker run --name typedb-gs -d -v /opt/typedb-all-linux/server/data/ -p 1729:1729 vaticle/typedb:latest

as opposed to

docker run --name typedb -d -v ~/typedb:/opt/typedb-all-linux/server/data/ -p 1729:1729 vaticle/typedb:latest

Contains a slight change in the container name and anonymous volume.

  1. What does -gs mean and why do we need it?
  2. Why do we need anonymous volumes. If we explicitly state where the data will be stored on the host machine the user can easily see it and re-use it. That opens a vast area of experimentation here. Is that only out of concerns of creating some junk folder on their system?

I just added "-gs" so it is recognizable as the container used for getting started. I sometimes run multiple containers of the same type. I'm not opposed to using "typedb" though.

Regarding volumes, Docker strongly recommends letting it manage persistent volumes. Docker ensures that when the container is restarted the volume is attached (named or not). We could give it a name if we wanted to (e.g., typedb-data). The biggest thing is to let Docker manager where the volume is persisted to disk.

https://docs.docker.com/storage/volumes/

I just added "-gs" so it is recognizable as the container used for getting started. I sometimes run multiple containers of the same type. I'm not opposed to using "typedb" though.

Ah, so getting started. I see. It may be a good idea to distantiate a little bit from the most common container name. Should we use something more obvious? Like try-typedb?

Regarding volumes, Docker strongly recommends letting it manage persistent volumes. Docker ensures that when the container is restarted the volume is attached (named or not). We could give it a name if we wanted to (e.g., typedb-data). The biggest thing is to let Docker manager where the volume is persisted to disk.

Of course, they do. But we don't have any particular problem with the exact folder binding here. Only benefits of maximum predictability. Don't you think? It's not like it's a production environment. Accessing docker volumes from the host machine might be tricky at times. And it's confusing in terms of where to look for it.

Let's add try or gs and use the direct folder designation.

Volumes can be beneficial in terms of cross-platform usability.

Encompass most of the page (prerequisites, start, stop) into the tabs.

Discard the OS list at the beginning.

Volumes can be beneficial in terms of cross-platform usability.

Encompass most of the page (prerequisites, start, stop) into the tabs.

Discard the OS list at the beginning.

Fixed in 12b6ec4

It looks good with all of the content within the tabs, but let's apply a little structure to it as well. The idea is for each installation to have Install, Start and Stop sections.

--- BEGIN

Docker

Install (H2)

  1. Install Docker

  2. Confirm the Docker daemon is running

$docker version

  1. Pull the latest TypeDB Docker image

$ docker pull vaticle/typedb:latest

Start (H2)

The TypeDB container exposes TypeDB’s default port, 1729, and uses its default data directory, “/opt/typedb-all-linux/server/data”.

The following command starts a TypeDB container (try-typedb), maps its exposed port to the host machine and creates a named volume mapped to its data directory (try-typedb-data) -- making it accessible via localhost:1729 and ensuring its data persists after the container is stopped.

$ docker run --name try-typedb -d -v try-typedb-data:/opt/typedb-all-linux/server/data/ -p 1729:1729 vaticle/typedb:latest

Stop (H2)

$ docker stop try-typedb

--- END