Docker file does not COPY files in subdirectories correctly when pushing to a local Balena device from Windows 10Import a file from a subdirectory?How to copy a folder from remote to local using scp?Copying files from Docker container to hostCopying files from host to Docker containerHow to copy Docker images from one host to another without using a repositoryHow to include files outside of Docker's build context?Docker COPY not updating files when rebuilding containerCan't complete npm install when directing Docker to local NPM packagesDocker: Using COPY when the Dockerfile is located in a subdirectoryFile copied to Docker image dissappears

Is the destination of a commercial flight important for the pilot?

How does the UK government determine the size of a mandate?

How do I go from 300 unfinished/half written blog posts, to published posts?

Class Action - which options I have?

Did the DC-9 ever use RATO in revenue service?

Anatomically Correct Strange Women In Ponds Distributing Swords

Why are there no referendums in the US?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

Fine Tuning of the Universe

Unreliable Magic - Is it worth it?

Lay out the Carpet

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Is expanding the research of a group into machine learning as a PhD student risky?

How do I find the solutions of the following equation?

How do scammers retract money, while you can’t?

What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?

What is paid subscription needed for in Mortal Kombat 11?

A particular customize with green line and letters for subfloat

How easy is it to start Magic from scratch?

Why not increase contact surface when reentering the atmosphere?

How did Arya survive the stabbing?

Crossing the line between justified force and brutality

How does buying out courses with grant money work?

Closest Prime Number



Docker file does not COPY files in subdirectories correctly when pushing to a local Balena device from Windows 10


Import a file from a subdirectory?How to copy a folder from remote to local using scp?Copying files from Docker container to hostCopying files from host to Docker containerHow to copy Docker images from one host to another without using a repositoryHow to include files outside of Docker's build context?Docker COPY not updating files when rebuilding containerCan't complete npm install when directing Docker to local NPM packagesDocker: Using COPY when the Dockerfile is located in a subdirectoryFile copied to Docker image dissappears













2















I am writing a Typescript app that I want to run on several Raspberry Pis managed and deployed using Balena. My dev computer is running Windows 10. I am fairly new to Balena and Docker.



I am trying to compile my typescript in the Docker file, but the COPY command does not seem to copy files in subdirectories correctly when pushing to a Balena device running in local mode.



I have a very simple file structure as I have just initiated the project:



Dockerfile
start.sh
src/
- index.ts
- tsconfig.json


My Dockerfile looks as follows:



FROM resin/raspberrypi3-node:10.0.0
WORKDIR /usr/src/app
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm i -g typescript
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*

COPY . ./
RUN tsc -p src
CMD ["bash", "start.sh"]


When building and pushing the image to the Balena device in local mode I get the following error when the execution of the Dockerfile reaches the 'RUN tsc -p src' command:



[Build] [main] Step 8/11 : RUN tsc -p src
[Build] [main] ---> Running in b843b59050da
[Build] [main] error TS5058: The specified path does not exist: 'src'.
Some services failed to build:
main: The command '/bin/sh -c tsc -p src' returned a non-zero code: 1


Likewise I cannot cd to the subdirectory and just run the tsc command from there:



[Build] [main] Step 8/11 : RUN cd src
[Build] [main] ---> Running in 7620e8a516f3
[Build] [main] /bin/sh: 1: cd: can't cd to src


I inserted a 'RUN ls' command into my Dockerfile before 'RUN tsc -p src' to verify the files are being copied which prints out the following:



[Build] [main] Step 8/11 : RUN ls
[Build] [main] ---> Running in bf8b3c63454e
[Build] [main] CHANGELOG.md
[Build] Dockerfile
[Build] README.md
[Build] node_modules
[Build] package-lock.json
[Build] package.json
[Build] srcindex.ts
[Build] srctsconfig.json
[Build] start.sh
[Build] [main] Removing intermediate container bf8b3c63454e
[Build] [main] ---> 27ed6ea5eb9b
[Build] [main] Step 9/11 : RUN tsc -p src
[Build] [main] ---> Running in 6ac5f86b5637
[Build] [main] error TS5058: The specified path does not exist: 'src'.


At first glance it seems like the subdirectory is copied correctly but - correct me if I am wrong - ls should not be able to list files from subdirectories and it seems like the COPY command has somehow flattened the subdirectory. Honestly I am quit uncertain what happened.



Worth noting: the project compiles the TS just fine when just running 'tsc -p src' from the terminal of my dev computer and the files are copied correctly when pushing the project to a Balene device NOT running in local mode. It is when I push the project to a Balena device running in local mode it fails to copy files correctly.



Is there anything obvious I am missing?










share|improve this question




























    2















    I am writing a Typescript app that I want to run on several Raspberry Pis managed and deployed using Balena. My dev computer is running Windows 10. I am fairly new to Balena and Docker.



    I am trying to compile my typescript in the Docker file, but the COPY command does not seem to copy files in subdirectories correctly when pushing to a Balena device running in local mode.



    I have a very simple file structure as I have just initiated the project:



    Dockerfile
    start.sh
    src/
    - index.ts
    - tsconfig.json


    My Dockerfile looks as follows:



    FROM resin/raspberrypi3-node:10.0.0
    WORKDIR /usr/src/app
    COPY package.json package.json
    COPY package-lock.json package-lock.json
    RUN npm i -g typescript
    RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*

    COPY . ./
    RUN tsc -p src
    CMD ["bash", "start.sh"]


    When building and pushing the image to the Balena device in local mode I get the following error when the execution of the Dockerfile reaches the 'RUN tsc -p src' command:



    [Build] [main] Step 8/11 : RUN tsc -p src
    [Build] [main] ---> Running in b843b59050da
    [Build] [main] error TS5058: The specified path does not exist: 'src'.
    Some services failed to build:
    main: The command '/bin/sh -c tsc -p src' returned a non-zero code: 1


    Likewise I cannot cd to the subdirectory and just run the tsc command from there:



    [Build] [main] Step 8/11 : RUN cd src
    [Build] [main] ---> Running in 7620e8a516f3
    [Build] [main] /bin/sh: 1: cd: can't cd to src


    I inserted a 'RUN ls' command into my Dockerfile before 'RUN tsc -p src' to verify the files are being copied which prints out the following:



    [Build] [main] Step 8/11 : RUN ls
    [Build] [main] ---> Running in bf8b3c63454e
    [Build] [main] CHANGELOG.md
    [Build] Dockerfile
    [Build] README.md
    [Build] node_modules
    [Build] package-lock.json
    [Build] package.json
    [Build] srcindex.ts
    [Build] srctsconfig.json
    [Build] start.sh
    [Build] [main] Removing intermediate container bf8b3c63454e
    [Build] [main] ---> 27ed6ea5eb9b
    [Build] [main] Step 9/11 : RUN tsc -p src
    [Build] [main] ---> Running in 6ac5f86b5637
    [Build] [main] error TS5058: The specified path does not exist: 'src'.


    At first glance it seems like the subdirectory is copied correctly but - correct me if I am wrong - ls should not be able to list files from subdirectories and it seems like the COPY command has somehow flattened the subdirectory. Honestly I am quit uncertain what happened.



    Worth noting: the project compiles the TS just fine when just running 'tsc -p src' from the terminal of my dev computer and the files are copied correctly when pushing the project to a Balene device NOT running in local mode. It is when I push the project to a Balena device running in local mode it fails to copy files correctly.



    Is there anything obvious I am missing?










    share|improve this question


























      2












      2








      2








      I am writing a Typescript app that I want to run on several Raspberry Pis managed and deployed using Balena. My dev computer is running Windows 10. I am fairly new to Balena and Docker.



      I am trying to compile my typescript in the Docker file, but the COPY command does not seem to copy files in subdirectories correctly when pushing to a Balena device running in local mode.



      I have a very simple file structure as I have just initiated the project:



      Dockerfile
      start.sh
      src/
      - index.ts
      - tsconfig.json


      My Dockerfile looks as follows:



      FROM resin/raspberrypi3-node:10.0.0
      WORKDIR /usr/src/app
      COPY package.json package.json
      COPY package-lock.json package-lock.json
      RUN npm i -g typescript
      RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*

      COPY . ./
      RUN tsc -p src
      CMD ["bash", "start.sh"]


      When building and pushing the image to the Balena device in local mode I get the following error when the execution of the Dockerfile reaches the 'RUN tsc -p src' command:



      [Build] [main] Step 8/11 : RUN tsc -p src
      [Build] [main] ---> Running in b843b59050da
      [Build] [main] error TS5058: The specified path does not exist: 'src'.
      Some services failed to build:
      main: The command '/bin/sh -c tsc -p src' returned a non-zero code: 1


      Likewise I cannot cd to the subdirectory and just run the tsc command from there:



      [Build] [main] Step 8/11 : RUN cd src
      [Build] [main] ---> Running in 7620e8a516f3
      [Build] [main] /bin/sh: 1: cd: can't cd to src


      I inserted a 'RUN ls' command into my Dockerfile before 'RUN tsc -p src' to verify the files are being copied which prints out the following:



      [Build] [main] Step 8/11 : RUN ls
      [Build] [main] ---> Running in bf8b3c63454e
      [Build] [main] CHANGELOG.md
      [Build] Dockerfile
      [Build] README.md
      [Build] node_modules
      [Build] package-lock.json
      [Build] package.json
      [Build] srcindex.ts
      [Build] srctsconfig.json
      [Build] start.sh
      [Build] [main] Removing intermediate container bf8b3c63454e
      [Build] [main] ---> 27ed6ea5eb9b
      [Build] [main] Step 9/11 : RUN tsc -p src
      [Build] [main] ---> Running in 6ac5f86b5637
      [Build] [main] error TS5058: The specified path does not exist: 'src'.


      At first glance it seems like the subdirectory is copied correctly but - correct me if I am wrong - ls should not be able to list files from subdirectories and it seems like the COPY command has somehow flattened the subdirectory. Honestly I am quit uncertain what happened.



      Worth noting: the project compiles the TS just fine when just running 'tsc -p src' from the terminal of my dev computer and the files are copied correctly when pushing the project to a Balene device NOT running in local mode. It is when I push the project to a Balena device running in local mode it fails to copy files correctly.



      Is there anything obvious I am missing?










      share|improve this question
















      I am writing a Typescript app that I want to run on several Raspberry Pis managed and deployed using Balena. My dev computer is running Windows 10. I am fairly new to Balena and Docker.



      I am trying to compile my typescript in the Docker file, but the COPY command does not seem to copy files in subdirectories correctly when pushing to a Balena device running in local mode.



      I have a very simple file structure as I have just initiated the project:



      Dockerfile
      start.sh
      src/
      - index.ts
      - tsconfig.json


      My Dockerfile looks as follows:



      FROM resin/raspberrypi3-node:10.0.0
      WORKDIR /usr/src/app
      COPY package.json package.json
      COPY package-lock.json package-lock.json
      RUN npm i -g typescript
      RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/*

      COPY . ./
      RUN tsc -p src
      CMD ["bash", "start.sh"]


      When building and pushing the image to the Balena device in local mode I get the following error when the execution of the Dockerfile reaches the 'RUN tsc -p src' command:



      [Build] [main] Step 8/11 : RUN tsc -p src
      [Build] [main] ---> Running in b843b59050da
      [Build] [main] error TS5058: The specified path does not exist: 'src'.
      Some services failed to build:
      main: The command '/bin/sh -c tsc -p src' returned a non-zero code: 1


      Likewise I cannot cd to the subdirectory and just run the tsc command from there:



      [Build] [main] Step 8/11 : RUN cd src
      [Build] [main] ---> Running in 7620e8a516f3
      [Build] [main] /bin/sh: 1: cd: can't cd to src


      I inserted a 'RUN ls' command into my Dockerfile before 'RUN tsc -p src' to verify the files are being copied which prints out the following:



      [Build] [main] Step 8/11 : RUN ls
      [Build] [main] ---> Running in bf8b3c63454e
      [Build] [main] CHANGELOG.md
      [Build] Dockerfile
      [Build] README.md
      [Build] node_modules
      [Build] package-lock.json
      [Build] package.json
      [Build] srcindex.ts
      [Build] srctsconfig.json
      [Build] start.sh
      [Build] [main] Removing intermediate container bf8b3c63454e
      [Build] [main] ---> 27ed6ea5eb9b
      [Build] [main] Step 9/11 : RUN tsc -p src
      [Build] [main] ---> Running in 6ac5f86b5637
      [Build] [main] error TS5058: The specified path does not exist: 'src'.


      At first glance it seems like the subdirectory is copied correctly but - correct me if I am wrong - ls should not be able to list files from subdirectories and it seems like the COPY command has somehow flattened the subdirectory. Honestly I am quit uncertain what happened.



      Worth noting: the project compiles the TS just fine when just running 'tsc -p src' from the terminal of my dev computer and the files are copied correctly when pushing the project to a Balene device NOT running in local mode. It is when I push the project to a Balena device running in local mode it fails to copy files correctly.



      Is there anything obvious I am missing?







      docker copy dockerfile subdirectory






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 11 at 9:52







      Tobias Emil Harbo

















      asked Mar 8 at 11:17









      Tobias Emil HarboTobias Emil Harbo

      113




      113






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062122%2fdocker-file-does-not-copy-files-in-subdirectories-correctly-when-pushing-to-a-lo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55062122%2fdocker-file-does-not-copy-files-in-subdirectories-correctly-when-pushing-to-a-lo%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme