概述
1 安装包官方地址:https://download.docker.com/linux/static/stable/x86_64/
2 解压 :tar -zxvf docker-18.09.7-ce.tgz
3 将解压出来的docker文件复制到 /usr/bin/ 目录下
cp /opt/docker/* /usr/bin/
4 在/etc/systemd/system/目录下新建docker.service文件,将docker注册为service服务
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker。127.1.1.1可以设置成自己的ip
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=127.0.0.1
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
5 启动docker
给docker.service文件添加执行权
chmod +x /etc/systemd/system/docker.service
重新加载配置文件(每次有修改docker.service文件时都要重新加载下)
systemctl daemon-reload
启动
systemctl start docker
设置开机启动
systemctl enable docker.service
查看docker服务状态
systemctl status docker
6,设置镜像仓库
官网本身有自己存储镜像的仓库,但是拉取镜像的时候比较慢,一般都是设置第三方docker仓库来pull或者push镜像
vim /etc/docker/daemon.json
我用的是网易的仓库,将下列配置放到daemon.json文件里
"registry-mirrors": ["http://hub-mirror.c.163.com","http://f1361db2.m.daocloud.io"]
7,docker images 查看已有镜像
8,docker pull neo4j 从仓库拉取neo4j镜像
9,安装容器,一般都是用命令行安装,
docker run --name neo4j --detach --publish=7474:7474 --publish=7687:7687 --volume=/root/java/neo4j/data:/data --volume=/root/java/neo4j/logs:/logs --volume=/root/java/neo4j/conf:/conf neo4j
有时候也用docker-compose来封装下,Compose是 docker 提供的一个命令行工具,用来定义和运行由多个容器组成的应用,以 YAML 文件(docker-compose.yml)声明式的定义应用程序的各个服务(容器)
所以:
创建vim /opt/neo4j/docker-compose.yml
version: '3'
services:
neo4j:
image: neo4j:4.0.6
volumes:
- "/opt/neo4j/data:/data"
- "/opt/neo4j/plugins:/plugins"
- "/opt/neo4j/import:/import"
- "/opt/neo4j/logs:/logs"
ports:
- "7474:7474"
- "7473:7473"
- "7687:7687"
environment:
dbms.default_advertised_address: "你ip"
10,安装docker-compose
两种方式:
①curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /opt/docker-compose
chmod +x /usr/local/bin/docker-compose
②安装python-pip
yum -y install epel-release
yum -y install python-pip
利用pip安装docker-compose
pip install docker-compose
11,运行neo4j,
cd /opt/neo4j/
docker-compose up
注:找不到原作者出处,仅学习自用,如若涉及侵权,请联系删除
最后
以上就是飞快小土豆为你收集整理的图数据库neo4j:Docker安装及部署neo4j的全部内容,希望文章能够帮你解决图数据库neo4j:Docker安装及部署neo4j所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复