官术网_书友最值得收藏!

Running Neo4j in a Docker container

Now, run this long command in a Terminal to run Docker with a Neo4j image. Explanations are coming just after:

docker run --rm --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs neo4j:3.1.2

This triggered some downloading because your local Docker repository does not have the Neo4j image available in its 3.1.2 version yet. Meanwhile, a useful magical incantation is to sing "run, baby, run"

Its form is: docker command parameters imageName:version.

Ports used by Neo4j are 7474, 7473, and 7687, for the protocols http, https, and bolt, respectively .

In the parameters part, you can see--volume twice. Its use is to link the folder on your local filesystem to the container filesystem.

Then, providing the port numbers given as parameters were not in use, your Terminal should display something like this:

>
Docker container started

This informs you that Neo4j is expecting you to connect on port 7474 as usual. So fire your browser and browse to the very same URL we saw earlier, http://localhost:7474, and go graphing! (Your data will be persisted on disk.)

In order to stop Docker running your image, you need to pass not the name (of the image) but the identifier of the running container (based on the image).

So first, in another Terminal, type as follows:

docker ps

This will list all the containers running, in our case, only one. So we look at the first column, container_id, and use it as a parameter:

docker stop container_id
Docker container stopped as it should be stopped
In fact, the parameter given can only be a part of the ID as long as it strictly identifies a container. In our case, with only one container, the first character is enough.
Docker container stopped with laziness
主站蜘蛛池模板: 张北县| 衢州市| 华蓥市| 西和县| 若尔盖县| 南江县| 青海省| 太保市| 资兴市| 泰来县| 江川县| 克东县| 平舆县| 伊金霍洛旗| 靖江市| 炉霍县| 沅江市| 哈巴河县| 郑州市| 北安市| 枣庄市| 苏州市| 固始县| 牟定县| 连云港市| 贵溪市| 青岛市| 桑日县| 金阳县| 龙门县| 会泽县| 雅江县| 柘城县| 莱阳市| 连云港市| 嵊泗县| 鄱阳县| 准格尔旗| 龙井市| 新疆| 井冈山市|