dockerfile

How do I Run Docker cmds Exactly Like in a Dockerfile

試著忘記壹切 提交于 2021-02-11 12:33:31
问题 There seems to be a difference between how Docker runs commands in a Dockerfile versus running commands manually after starting a container. This seems to be due to the kind of shells you can start, a (I assume) non-interactive shell with a Dockerfile vs an interactive one when running something like docker run -it <some-img-id> . How can I debug running commands in a Docker container so that it runs exactly like the commands are run from a Dockerfile? Would just adding /bin/bash --noprofile

How to connect to other container from Dockerfile while docker-compose build

余生长醉 提交于 2021-02-11 12:29:26
问题 I try to configure docker compose for my php project. On deploy I want to update a source code, update composer dependencies and run database migrations. So I have a docker-compose.yml file: version: '3.0' services: php: build: context: . dockerfile: php/Dockerfile depends_on: - postgres postgres: image: "postgres:13-alpine" restart: always environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB_NAME} Php container builds from the next

Install yarn global on Docker file

旧时模样 提交于 2021-02-11 12:23:24
问题 I'm trying to get a global package recognized by yarn and the docker image. FROM ruby:2.7.2 RUN apt-get update -qq && apt-get install -y nodejs libvips-tools yarn # Install all gems first. # This hits the warm cache if unchanged so bundling is faster. COPY Gemfile* /tmp/ WORKDIR /tmp RUN bundle install WORKDIR /sapco COPY . /sapco # Get yarn and install global required packages RUN yarn global add mjml EXPOSE 3000 # Start the main process. CMD ["rails", "server", "-b", "0.0.0.0"] I build this

Bind .m2 file to docker on build stage

孤街浪徒 提交于 2021-02-10 20:49:01
问题 I tried build a spring boot project in docker container based on below docker file.But every times all mvn dependency download from internet. How can I bind local .m2 file when i build the docker file. This is my Dockerfile FROM maven:3.5-jdk-8-alpine AS build COPY /src /usr/src/javaspring/src COPY pom.xml /usr/src/javaspring COPY Dockerfile /usr/src/javaspring RUN mvn -f /usr/src/javaspring/pom.xml clean install FROM openjdk:8-jre-alpine COPY --from=build /usr/src/javaspring/target

Bind .m2 file to docker on build stage

倖福魔咒の 提交于 2021-02-10 20:45:36
问题 I tried build a spring boot project in docker container based on below docker file.But every times all mvn dependency download from internet. How can I bind local .m2 file when i build the docker file. This is my Dockerfile FROM maven:3.5-jdk-8-alpine AS build COPY /src /usr/src/javaspring/src COPY pom.xml /usr/src/javaspring COPY Dockerfile /usr/src/javaspring RUN mvn -f /usr/src/javaspring/pom.xml clean install FROM openjdk:8-jre-alpine COPY --from=build /usr/src/javaspring/target

Docker configuration does not find existing file?

那年仲夏 提交于 2021-02-10 18:14:04
问题 I try to configure and run a docker file in IntelliJ Rider. During the build, I get the following error: Step 7/17 : COPY ["src/No.Services/No.Gf/No.Gf.Api/No.Gf.Api.csproj", "src/No.Services/No.Gf/No.Gf.Api/"] Error response from daemon: COPY failed: file not found in build context or excluded by .dockerignore: stat src\No.Services\No.Gf\No.Gf.Api\No.Gf.Api.csproj: file does not exist The file is right where the path points to. It's not exluded in .dockerignore. I am out of options here?

How to clone git repo using Dockerfile

丶灬走出姿态 提交于 2021-02-10 16:18:13
问题 I am a beginner to Docker. I have written a small Dockerfile to start with. I am not able to clone my repo using following Dockerfile . FROM mattes/hello-world-nginx RUN apt-get update && apt-get install -y git RUN git clone https://github.com/umairnow/LocalizableGenerator.git VOLUME LocalizableGenerator I am not sure if I am doing it right or do I have to use WORKDIR . I have also tried following but it doesn't clone the repo. VOLUME ["/data"] WORKDIR /LocalizableGenerator Can anyone help

How to put command of build docker container to dockerfile?

走远了吗. 提交于 2021-02-10 14:14:45
问题 I have script: docker run -it -p 4000:4000 bitgosdk/express:latest --disablessl -e test how to put this command to dockerfile with arguments? FROM bitgosdk/express:latest EXPOSE 4000 ??? 回答1: Gone through your Dockerfile contents. The command running inside container is: / # ps -ef | more PID USER TIME COMMAND 1 root 0:00 /sbin/tini -- /usr/local/bin/node /var/bitgo-express/bin/bitgo-express --disablessl -e test The command is so because the entrypoint set in the Dockerfile is ENTRYPOINT ["

Docker build image - glob error { Error: EPERM: operation not permitted, scandir

China☆狼群 提交于 2021-02-09 02:48:47
问题 I'm attempting to build a Docker image of a React+TypeScript+NodeJS application built with Webpack 2.0, but I get the following error > frontend@0.0.1 build / > webpack -p --config configs/webpack.config.ts --env.build --env.sourceMap { isDev: false } glob error { Error: EPERM: operation not permitted, scandir '/proc/1/map_files/55836c87b000-55836c897000' errno: -1, code: 'EPERM', syscall: 'scandir', path: '/proc/1/map_files/55836c87b000-55836c897000' } Error: EPERM: operation not permitted,

How to run mongorestore after mongod in docker

青春壹個敷衍的年華 提交于 2021-02-08 20:54:06
问题 I'm trying to set up a mongodb-server with docker, let it download a dump from the web and populate it with that info. My problem is that I can make it run and fill the database, but after it's done that, it just closes. This was how I went about solving my problem: sudo -u mongodb /usr/bin/mongod --config $conf $args & mongorestore dump The problem here is that I can't run mongorestore if mongod isn't running, but if I start mongod with mongod & , then the container will close down after