作者:嘿听tj说你是被搞出来的 | 来源:互联网 | 2023-07-31 08:08
docker安装php使用dnnmmp单独安装nodejs的。软件地址:https:github.comwallace530…安装步骤如下:本地安装git、docker和docke
docker安装php
使用dnnmmp单独安装nodejs的。
软件地址:
https://github.com/wallace530…
安装步骤如下:
- 本地安装
git
、docker
和docker-compose
(建议使用最新版本:1.23)。
clone
项目:
# 如果不是`root`用户,那么将当前用户加入`docker`用户组
$ sudo gpasswd -a ${USER} docker
# 获取项目
$ git clone https://github.com/wallace5303/dnnmmp.git
构建并启动:
$ cd dnnmmp
# 构建
$ docker-compose up -d node
查看容器:
$ docker container ls -a
命令行使用
编辑
~/.bashrc(或 ~/.zshrc)
,并在行尾添加
# 如果电脑上已经安装过软件,请更换函数名称
node () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--volume $PWD:/var/www/html:rw \
--workdir /var/www/html \
dnnmmp_node node "$@"
}
npm () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--volume $PWD:/var/www/html:rw \
--workdir /var/www/html \
dnnmmp_node npm "$@"
}
(3)让修改的内容生效
$ source ~/.bashrc(或 ~/.zshrc)
(4)查看版本信息
$ node -v
v10.16.0
$ npm -v
6.9.0