Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

383
Vistas
Build docker in ASP.NET Core: "no such file or directory" error

I'm getting an error when I build my docker.

Sending build context to Docker daemon 3.584 kB
Step 1/8 : FROM microsoft/aspnetcore:1.1
 ---> 2628aaa7b8cf
Step 2/8 : ENV ASPNETCORE_URLS "http://*:5000"
 ---> Using cache
 ---> 5dffde204fef
Step 3/8 : ENV ASPNETCORE_ENVIRONMENT "Development"
 ---> Using cache
 ---> 3064358bc0eb
Step 4/8 : ARG source
 ---> Using cache
 ---> 4159d0eb78c0
Step 5/8 : WORKDIR /app
 ---> Using cache
 ---> 61a394c84304
Step 6/8 : EXPOSE 5000
 ---> Using cache
 ---> c7c2309f7085
Step 7/8 : COPY ${source:-obj/Docker/publish} .
lstat obj/Docker/publish: no such file or directory

Here's my Dockerfile.

FROM microsoft/aspnetcore:1.1
ENV ASPNETCORE_URLS="http://*:5000"
ENV ASPNETCORE_ENVIRONMENT="Development"
ARG source
WORKDIR /app
EXPOSE 5000
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "ProjectTestApi.dll"

and I run a command:

$ docker build -t my-docker-image-test .

Do you have any ide what is wrong?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

It's happening because you didn't published your solution. The error message is self-explanatory:

no such file or directory

By default, when you add Docker support to you ASP.NET Core Visual Studio 2017 project, it creates a bunch of docker-compose.yml files, one of them is docker-compose.ci.build.yml which handles the build process. Then, when you build the project through Visual Studio, full docker-compose pipeline is executed.

The contents of docker-compose.ci.build.yml, are similiar to this (it depends on custom config and project names obviously):

version: '2'

services:
  ci-build:
    image: microsoft/aspnetcore-build:1.0-1.1
    volumes:
      - .:/src
    working_dir: /src
    command: /bin/bash -c "dotnet restore ./SolutionName.sln && dotnet publish ./SolutionName.sln -c Release -o ./obj/Docker/publish"

As you can see in the last line, there is a dotnet publish command invoked, which actually builds & publishes your project.

So the solution for your issue, will be just building the project before calling docker:

dotnet publish ./SolutionName.sln -c Release -o ./obj/Docker/publish
docker build -t my-docker-image-test .
over 4 years ago · Santiago Trujillo Denunciar

0

When you use the option "Add Docker Support" in Visual Studio 2017, VS generates a bunch of docker-compose files and Dockerfiles. As Marcin Zablocki mentioned, one of these is docker-compose.ci.build.yml.

To stay in line with the Docker philosophy, you can use a docker container to publish your project. To publish your project you would take the following steps:

  1. git clone/pull your project & cd into the root dir
  2. Publish your project with docker-compose -f docker-compose.ci.build.yml up
  3. Start your project with docker-compose up

I have encountered situations where the Dockerfile of your main project is giving problems. This happens with FROM microsoft/aspnetcore:1.1, you can change it to FROM microsoft/aspnetcore:1.1.2 or whatever version is needed for your project.

over 4 years ago · Santiago Trujillo Denunciar

0

If you have published your project and facing this issue because of directory error, just move the docker file one folder up and put it beside *.sln file.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda