FROM python:3.10.0a6-buster
ENV env=/root/env
ENV PATH="$env/bin:$PATH"
WORKDIR /root
# Copy relevant files to work directory
COPY Resources .
COPY results .
COPY Tests .
#install robotframework
RUN python3 -m pip install robotframework==5.0.1
RUN python3 -m pip install --upgrade pip
RUN pip install robotframework-appiumlibrary==2.0.0
#install appium
from node:latest
RUN npm install -g appium
# Execute file
CMD ["appium"]
EXPOSE 4723
#CMD ["appium --port 4723"]
CMD ["robot", "-d", "results", "login.robot"]
**Getting below error while running the docker image**
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module '/robot'
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v19.2.0
Related
Docker build failed.
Here I attached my docker file and command what I used.
Please let me know what can be issue.
I am using macOs.
FROM python:3.9 as base
ARG PIPENV_DEV
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps
# Install pipenv and compilation dependencies
RUN pip install pipenv
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libmemcached-dev \
libpq-dev
# Install python dependencies in /.venv
COPY Pipfile .
COPY Pipfile.lock .
RUN if [ -z "$PIPENV_DEV" ] ; then PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy ; else PIPENV_VENV_IN_PROJECT=1 pipenv install --dev ; fi
FROM base AS runtime
COPY --from=python-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
WORKDIR /src
COPY . .
COPY scripts/entrypoint.sh entrypoint.sh
COPY scripts/release.sh release.sh
EXPOSE 8000
ENTRYPOINT ["/src/entrypoint.sh"]
CMD ["gunicorn", "-c", "rn_api/config/gunicorn.py", "rn_api.config.wsgi:application"]
I used this command "docker build -t aaaaa ."
Error is happened in "RUN if [ -z "$PIPENV_DEV" ] ; then PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy ; else PIPENV_VENV_IN_PROJECT=1 pipenv install --dev ; fi".
Here is what the error looks like.
i have dockerfile with command to run install atop but, i dont know why i am getting error
The command '/bin/bash -o pipefail -c apt install atop' returned a non-zero code: 1
enter image description here
this is my Dockerfile
FROM timbru31/java-node
RUN apt update
RUN apt install atop
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "node", "server.js" ]
You need a non-interactive installation. And you can do that on one RUN execution.
RUN apt update && \
apt install -y atop
I try to build a Docker image executing the code:
docker build . -t <YOUR_DOCKER_HUB_USERNAME>/my-nuxt-project
It is about a nuxt.js project but when I run the code I receive the following error:
Step 5/13 : RUN yarn build
---> Running in 4dd3684952ba
yarn run v1.22.19
$ nuxt build
ℹ Production build
ℹ Bundling for server and client side
ℹ Target: server
ℹ Using components loader to optimize imports
ℹ Discovered Components: .nuxt/components/readme.md
✔ Builder initialized
✔ Nuxt files generated
ℹ Compiling Client
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/app/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/app/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/app/node_modules/webpack/lib/NormalModule.js:471:10)
at /app/node_modules/webpack/lib/NormalModule.js:503:5
at /app/node_modules/webpack/lib/NormalModule.js:358:12
at /app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /app/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.0
error Command failed with exit code 1.
This is the Dockerfile that I am using. I am following the nuxt documentation to build the image.
FROM node:lts as builder
WORKDIR /app
COPY . .
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false
RUN yarn build
RUN rm -rf node_modules && \
NODE_ENV=production yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true
FROM node:lts
WORKDIR /app
COPY --from=builder /app .
ENV HOST 0.0.0.0
EXPOSE 3000
CMD [ "yarn", "start" ]
Anyone knows how to debug it?
Try adding NODE_OPTIONS=--openssl-legacy-provider as docker environment variable. So your Dockerfile should be like this. Try rebuilding your Dockerfile after this change.
FROM node:lts as builder
WORKDIR /app
ENV NODE_OPTIONS=--openssl-legacy-provider
COPY . .
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false
RUN yarn build
RUN rm -rf node_modules && \
NODE_ENV=production yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true
FROM node:lts
WORKDIR /app
COPY --from=builder /app .
ENV HOST 0.0.0.0
EXPOSE 3000
CMD [ "yarn", "start" ]
I have written a multi-stage dockerfile with pm-2 docker, but when I am trying to run pod with my image, pod crashes,
Dockerfile
FROM node:16.15.1-alpine3.16 as build
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
# Create app directory
WORKDIR /app
ENV NODE_OPTIONS --max-old-space-size=4096
# Install app dependencies
COPY package.json .
RUN apk update && apk add vim jq busybox-extras
RUN npm install pm2 -g
RUN npm install --save-exact
COPY . .
FROM node:16.15.1-alpine3.16 as main
COPY --from=build /app /
CMD ["pm2-docker", "index.js"]
Error
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/pm2-docker'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
multi-stage dockerfile written is correct?
I just faced this issue and like #Dr Claw said, adding npm install -g pm2 in the main image after COPY did the trick. I removed npm install -g pm2 from the build image
I am trying to build this public.ecr.aws/lambda/python:3.6 based Dockerfile with a requirements.txt file that contains some libraries that need gcc/g++ to build. I'm getting an error of a missing Python.h file despite the fact that I installed the python development package and /usr/include/python3.6m/Python.h exists in the file system.
Dockerfile
FROM public.ecr.aws/lambda/python:3.6
RUN yum install -y gcc gcc-c++ python36-devel.x86_64
RUN pip install --upgrade pip && \
pip install cyquant
COPY app.py ./
CMD ["app.handler"]
When I build this with
docker build -t redux .
I get the following error
cyquant/dimensions.cpp:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Notice, however, that my Dockerfile yum installs the development package. I have also tried the yum package python36-devel.i686 with no change.
What am I doing wrong?
The pip that you're executing lives in /var/lang/bin/pip whereas the python you're installing lives in the /usr prefix
presumably you could use /usr/bin/pip directly to install, but I'm not sure whether that works correctly with the lambda environment
I was able to duplicate the behavior of the AWS Lambda functionality without their Docker image and it works just fine. This is the Dockerfile I am using.
ARG FUNCTION_DIR="/function/"
FROM python:3.6 AS build
ARG FUNCTION_DIR
ARG NETRC_PATH
RUN echo "${NETRC_PATH}" > /root/.netrc
RUN mkdir -p ${FUNCTION_DIR}
COPY requirements.txt ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}
RUN pip install --upgrade pip && \
pip install --target ${FUNCTION_DIR} awslambdaric && \
pip install --target ${FUNCTION_DIR} --no-warn-script-location -r requirements.txt
FROM python:3.6
ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
COPY --from=build ${FUNCTION_DIR} ${FUNCTION_DIR}
COPY main.py ${FUNCTION_DIR}
ENV MPLCONFIGDIR=/tmp/mplconfig
ENTRYPOINT ["/usr/local/bin/python", "-m", "awslambdaric"]
CMD ["main.handler"]