格式后,码头中的吞噬者正常停止工作

发布于 2025-01-25 08:46:06 字数 4426 浏览 2 评论 0原文

不久前,我使用 dockerfile 创建了一个图像,以 gulp 安装节点容器,所使用的基座是 debian ,一切正常,但是当我再次格式化并安装了所有内容时,它停止了以前的工作方式。

使用此命令,创建了图像,按照千古的日志,所有内容都是正常安装的。

sudo docker build -t app_node .

创建图像后,我将创建一个具有其他代码的容器:

docker run -it -v $PWD:/mi_app -p 8051:3001 -e PUID=1001 -e PGID=100 --name node_container app_node

创建的卷是Web文件夹,该文件夹带有以前正确奏效的文件。执行此命令后,它将进入容器,我可以执行 Gulp 命令完美,一切正常,但是一旦我点击 exit ,容器就会停止,如果我激活它再次使用 docker start ,然后将gulp命令运行正常,现在给我带来了一个错误:

命令docker exec:

docker exec -d node_container gulp babel_a && gulp minifi_a

错误:

Error: No such container: gulp

web我要应用的页面位于/home/user/web

gulpfile.js

var gulp = require('gulp'),
  concat = require('gulp-concat'),
  uglify = require('gulp-uglify'),
  rename=require('gulp-rename'),
  clean = require('gulp-clean'),
  cssmin = require('gulp-cssmin'),
  replace = require('gulp-string-replace'),
  clean = require('gulp-clean'),
  babel = require('gulp-babel');




gulp.task('babel_a', async function () {


  gulp.src('www/js/*.js')

  .pipe(babel({
            presets: ["@babel/preset-env"]
        }))



  //.pipe(concat('cs.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/js/mov'));



  gulp.src(['www/blog/js/*.js',


   '!www/blog/js/jquery.cropit.js' // <== ignore file 
    ])

  .pipe(babel({
            presets: ["@babel/preset-env"]
        }))

  //.pipe(concat('cs.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/blog/js/mov'));




  gulp.src('www/blog/js/jquery.cropit.js'  
    )
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/blog/js/mov'));



});




gulp.task('minifi_a', async function () {


 gulp.src('www/js/mov/*.min.js')

  //.pipe(concat('cs.js'))
  .pipe(uglify())
  .pipe(rename({ prefix: '01-' }))
  .pipe(gulp.dest('www/js/'));

  gulp.src('www/blog/js/mov/*.min.js')
  //.pipe(concat('cs.js'))
  .pipe(uglify())
  .pipe(rename({ prefix: '01-' }))
  .pipe(gulp.dest('www/blog/js/'));




  gulp.src('www/blog/js/mov/*.min.js')

  .pipe(clean());

  gulp.src('www/js/mov/*.min.js')

  .pipe(clean());

//CSS

   gulp.src('www/css/*.css')
 

        .pipe(cssmin())
        .pipe(replace('}@media', '} @media'))
        .pipe(rename({suffix: '.min'}))
         .pipe(rename({ prefix: '01-' }))
        .pipe(gulp.dest('www/css/'));


});

package

{
  "name": "web",
  "version": "1.0.0",
  "description": "",
  "main": "gulpfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.17.9",
    "@babel/preset-env": "^7.16.11",
    "gulp": "^4.0.2",
    "gulp-babel": "^8.0.0",
    "gulp-clean": "^0.4.0",
    "gulp-concat": "^2.6.1",
    "gulp-cssmin": "^0.2.0",
    "gulp-rename": "^2.0.0",
    "gulp-string-replace": "^1.1.2",
    "gulp-uglify": "^3.0.2"
  }
}

dockerfile:

FROM debian

RUN mkdir /mi_app
WORKDIR /mi_app
EXPOSE 3001

RUN apt-get update \
 && apt-get install -y sudo

RUN adduser --disabled-password --gecos '' docker
RUN adduser docker sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER docker

CMD /bin/bash

RUN cd /

RUN sudo apt-get install apt-utils && sudo apt install -y curl

RUN sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - 

RUN sudo apt-get update && sudo apt-get install nodejs

RUN sudo npm install -g npm -y && node -v && npm -v

RUN sudo npm install gulp -g && gulp -v

RUN cd /mi_app

RUN sudo npm init -y

RUN sudo npm install gulp && gulp -v

RUN sudo npm install --save-dev gulp-concat gulp-uglify gulp-rename gulp-clean

RUN sudo npm install --save-dev gulp-cssmin gulp-string-replace gulp-clean

RUN sudo npm install --save-dev gulp-babel @babel/core @babel/preset-env

我试图找出为什么会出现该错误,如果一切都像以前一样完成并安装了,为什么会抛出该错误?系统中缺少某些东西吗?我想念什么?

some time ago I created an image using a Dockerfile to mount a node container with gulp, the base used is Debian and everything worked correctly, but when I formatted and installed everything again it stopped working the way it was doing previously.

With this command the image is created, following the log that is kilometric, everything is installed normally.

sudo docker build -t app_node .

Once the image is created, I create a container with this other code:

docker run -it -v $PWD:/mi_app -p 8051:3001 -e PUID=1001 -e PGID=100 --name node_container app_node

The created volume is the web folder with the files that previously worked correctly. Once this command is executed, it enters the container and I can execute the gulp commands perfectly, everything works perfectly, but once I hit exit, the container stops, if I activate it again with docker start and put the gulp command it worked Ok, now it throws me an error:

Command docker exec:

docker exec -d node_container gulp babel_a && gulp minifi_a

Error:

Error: No such container: gulp

The web page to which I want to apply the gulp commands is located in /home/user/web

folder site

gulpfile.js

var gulp = require('gulp'),
  concat = require('gulp-concat'),
  uglify = require('gulp-uglify'),
  rename=require('gulp-rename'),
  clean = require('gulp-clean'),
  cssmin = require('gulp-cssmin'),
  replace = require('gulp-string-replace'),
  clean = require('gulp-clean'),
  babel = require('gulp-babel');




gulp.task('babel_a', async function () {


  gulp.src('www/js/*.js')

  .pipe(babel({
            presets: ["@babel/preset-env"]
        }))



  //.pipe(concat('cs.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/js/mov'));



  gulp.src(['www/blog/js/*.js',


   '!www/blog/js/jquery.cropit.js' // <== ignore file 
    ])

  .pipe(babel({
            presets: ["@babel/preset-env"]
        }))

  //.pipe(concat('cs.js'))
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/blog/js/mov'));




  gulp.src('www/blog/js/jquery.cropit.js'  
    )
  .pipe(rename({ suffix: '.min' }))
  .pipe(gulp.dest('www/blog/js/mov'));



});




gulp.task('minifi_a', async function () {


 gulp.src('www/js/mov/*.min.js')

  //.pipe(concat('cs.js'))
  .pipe(uglify())
  .pipe(rename({ prefix: '01-' }))
  .pipe(gulp.dest('www/js/'));

  gulp.src('www/blog/js/mov/*.min.js')
  //.pipe(concat('cs.js'))
  .pipe(uglify())
  .pipe(rename({ prefix: '01-' }))
  .pipe(gulp.dest('www/blog/js/'));




  gulp.src('www/blog/js/mov/*.min.js')

  .pipe(clean());

  gulp.src('www/js/mov/*.min.js')

  .pipe(clean());

//CSS

   gulp.src('www/css/*.css')
 

        .pipe(cssmin())
        .pipe(replace('}@media', '} @media'))
        .pipe(rename({suffix: '.min'}))
         .pipe(rename({ prefix: '01-' }))
        .pipe(gulp.dest('www/css/'));


});

package.json

{
  "name": "web",
  "version": "1.0.0",
  "description": "",
  "main": "gulpfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.17.9",
    "@babel/preset-env": "^7.16.11",
    "gulp": "^4.0.2",
    "gulp-babel": "^8.0.0",
    "gulp-clean": "^0.4.0",
    "gulp-concat": "^2.6.1",
    "gulp-cssmin": "^0.2.0",
    "gulp-rename": "^2.0.0",
    "gulp-string-replace": "^1.1.2",
    "gulp-uglify": "^3.0.2"
  }
}

Dockerfile:

FROM debian

RUN mkdir /mi_app
WORKDIR /mi_app
EXPOSE 3001

RUN apt-get update \
 && apt-get install -y sudo

RUN adduser --disabled-password --gecos '' docker
RUN adduser docker sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER docker

CMD /bin/bash

RUN cd /

RUN sudo apt-get install apt-utils && sudo apt install -y curl

RUN sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - 

RUN sudo apt-get update && sudo apt-get install nodejs

RUN sudo npm install -g npm -y && node -v && npm -v

RUN sudo npm install gulp -g && gulp -v

RUN cd /mi_app

RUN sudo npm init -y

RUN sudo npm install gulp && gulp -v

RUN sudo npm install --save-dev gulp-concat gulp-uglify gulp-rename gulp-clean

RUN sudo npm install --save-dev gulp-cssmin gulp-string-replace gulp-clean

RUN sudo npm install --save-dev gulp-babel @babel/core @babel/preset-env

I have tried to find out why it gives that error, if everything is done and installed as it was before, why does it throw that error? Is something missing in the system? what am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文