如何在Jenkins多分支pipe道中拖拉docker图像并旋转容器?

我正在编写一个Jenkinsfile来创build多分支pipe道和Docker / Dockerpipe道插件的构build,以便在Jenkins中启动Docker容器。 我有一个图像,我想用来build立docker集装箱。 我需要从一个特定的url中提取这个图片: docker.abc.com ,运行容器,然后在容器中完成Jenkins的所有东西。 我目前收到以下错误:

Jenkins does not seem to be running inside a container

我的代码看起来像这样:

 node { try { // set working directory dir(working directory here){ stage(main){ checkout scm docker.image("docker.abc.com/def:latest").inside{ // do Jenkins stuff } } } } catch { // catch error and send notification } } 

我几天前解决了这个问题。 我的代码结构(我不能分享确切的代码,对此感到抱歉):

 node { try { // set working directory dir(working directory here){ stage(main){ // get docker image // defined a docker command here that runs the container, clones git repository inside it and uses makefile to build the project // ran the docker command in a shell script } } } catch { // catch error and send notification } }