Questions tagged [workdir]

16 questions
137
votes
4 answers

Docker: What is the default WORKDIR in a Dockerfile?

We can use WORKDIR to set a directory as work directory in Dockerfile, but what's the default value if we don't set?
Freewind
  • 193,756
  • 157
  • 432
  • 708
8
votes
3 answers

Does WORKDIR create a directory?

These are the first 2 lines of a Dockerfile: FROM node:12 WORKDIR /code Here are some things I don't understand: From docker's documentation I know that the 2nd line sets the working directory to /code. Where does this process occur? Does it happen…
youhatch
  • 141
  • 3
  • 7
3
votes
1 answer

Docker - WORKDIR issue on alpine image (Multi-Stages build)

I have this second stage for my Dockerfile: ############################################ MULTI STAGE BUILD PART 2 ############################################## # Start from alpine image FROM alpine # Creating work directory WORKDIR /service #…
Emixam23
  • 3,854
  • 8
  • 50
  • 107
1
vote
1 answer

set WORKDIR using pattern

Is there a way to change the WORKDIR to the first pattern matched folder? something like SHELL ["/bin/bash", "-c"] RUN pattern=mypattern* RUN files=( $pattern ) WORKDIR $files Unlike my local terminal behaviour the files variable remains empty,…
1
vote
0 answers

Rust: Is there a simple way to tar a directory excluding some sub directories and files?

I am working on a small cli in rust and I would like to create a tgz file from a directory. I would like to exclude some files and directories from it though. For example I would like to exclude any .custom files from any directories. I ended up…
BenjaminC
  • 169
  • 7
1
vote
1 answer

How can I build a docker image with it parent folder as workdir?

This probably is a dumb question, but I'm newbie in Docker and I'm struggle with this. I have a project with many subfolders, like the example below: project-folder: folder_1: code1.py Dockerfile …
thatayster
  • 45
  • 2
  • 6
0
votes
1 answer

Use github actions to build a unity project where the project directory is inside of the main repository folder

So I've been trying to setup a pipeline to build a project following this tutorial: https://jaidengerig.medium.com/create-a-cd-pipeline-to-auto-publish-unity-games-from-github-to-itch-io-in-30-minutes-for-free-bae3b254283c But the main issue is that…
0
votes
1 answer

Why am I getting absolute path WORKDIR dockerfile vulnerability warning from Gitlab?

I have the following dockerfile for a project that is hosted with Kubernetes and Openshift and am getting a vulnerability warning from Gitlab that line 10 should use an absolute path instead of relative path for the sake of clarity and reliability.…
Reid P.
  • 33
  • 3
0
votes
2 answers

ImportError: attempted relative import with no known parent package PYTHON

I am trying to import some functions and variables from the parent directory. Here is what my dir looks like: I want the import: -- send_invoice func from bifatura_methods.py -- start func from xml_generator.py -- data_json_1, data_json_2 dicts…
Selman
  • 274
  • 2
  • 4
  • 17
0
votes
0 answers

Docker-compose and including files from outside the WORKDIR

I want to use Docker with APACHE, PHP, MYSQL projects with files structure like in Laravel where there is a 'public' folder with a public files and all of the apps files are one level higher in.ex. app, modules, node, vendor etc. I can setup…
Sandowl
  • 73
  • 1
  • 4
0
votes
1 answer

Workdir and dot at the end of directory path

I'm looking at this tutorial: https://learn.microsoft.com/en-us/learn/modules/implement-docker-multi-stage-builds/3-examine-multi-stage-dockerfiles And this part confuses me: FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build WORKDIR /src COPY…
Mr Patience
  • 1,564
  • 16
  • 30
0
votes
1 answer

Is it necessary to explicitly indicate the WORKDIR for each command in my Dockerfile?

I have the following file structure: Dockerfile: # syntax=docker/dockerfile:1 FROM python:3.8-slim-buster WORKDIR /home/pos COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt COPY /src /src CMD ["python",…
0
votes
2 answers

No such file or directory in copying a file

I have a problem. I want to install Python and Node.js in a same image. But there is a problem in copying the package.json. The error says no such file or directory, open '/opt/app/src/package.json'. So what is the probleme here? What did I might…
Test
  • 571
  • 13
  • 32
0
votes
0 answers

snakemake: access workdir from inside log_handler script

I am trying to create a custom log_handler script that can save the workflow´s log as a JSON file inside {workdir}/logs. For that I need to know what is the current workdir but I cannot seem to access is from inside the script. Does anyone know how…
FGV
  • 99
  • 1
  • 8
0
votes
1 answer

Git pull doesn't work and shows local files as modified with no modifications

I am trying to perform a git pull from outside the directory, and I am running this command: git --git-dir=$WORKDIR/sources/.git pull The output is "Alrady Up To Date" or it just "pulls" the modifications but the files are NOT the ones on the…
Rafael Moreira
  • 197
  • 1
  • 10
1
2