Makefile will not set the include directory for opencv4 - opencv

i have a problem with my makefile. It will not set the opencv include directory.
Makefile:
# Basic Vars
VERSION = 0.01
BIN = ./bin64/
SOURCE = ../native/
# DC Lib files
OBJ = $(addprefix $(BIN), DCFile.o \
DCDirectory.o \
DCSettings.o \
DCArguments.o \
DCSupport.o \
DCSQLConnection.o \
DCSQLSMRndArticle.o \
DCSQLStatement.o \
DCMachineLearning.o \
DCNeuralNetwork.o \
DCMarkerDetection.o \
DCTire.o \
DCEllipse.o \
DCGabor.o \
DCDewarp.o \
DCRimTrainData.o \
DCRimTrainDataGrab.o \
DCRimTrainDataGrabHD.o \
DCRimDetector.o \
DCTool.o)
# TOOL Specifics
# Classificator:
OBJ_CF = ./Classificator/Classificator.o
NAME_CF = classificator
CC = g++
CFLAGS = -Wall -O2 -s -DNDEBUG -DVERSION=\"$(VERSION)\"
CFLAGS += -I/usr/local/include/opencv4
LDFLAGS = -lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_imgcodecs -lopencv_highgui -lopencv_ml -lopencv_calib3d -lopencv_features2d -lpthread -lmysqlcppconn -lmysqlcppconn8
# Build Rules
all: classificator
classificator: makedir $(OBJ) $(OBJ_CF)
$(CC) $(CFLAGS) -o $(BIN)$(NAME_CF) $(OBJ) $(OBJ_CF) $(LDFLAGS)
$(BIN)%.o: $(SOURCE)%.cpp
$(CC) $(CFLAGS) -c $< -o $# $(LDFLAGS)
makedir:
mkdir -p $(BIN)
clean:
rm -rf $(BIN)
definclude.h
#pragma once
// Basic
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <cstdlib>
// Threading
#include <thread>
#include <chrono>
#include <mutex>
// OpenCV
#include <opencv2/opencv.hpp>
This massage was returned after this command:
make Classificator
g++ -c -o Classificator/Classificator.o
Classificator/Classificator.cpp In file included from
Classificator/../../native/DCSupport.h:3,
from Classificator/Classificator.cpp:4: Classificator/../../native/definclude.h:15:10: fatal error:
opencv2/core.hpp: Datei oder Verzeichnis nicht gefunden #include
^~~~~~~~~~~~~~~~~~
But the folder contains These files:
root#debian:/usr/local# dir /usr/local/include/opencv4/opencv2/ -l
insgesamt 1452
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 aruco
-rw-r--r-- 1 root staff 31327 Jun 12 08:43 aruco.hpp
-rw-r--r-- 1 root staff 16481 Jun 12 08:43 bgsegm.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 bioinspired
-rw-r--r-- 1 root staff 2716 Jun 12 08:43 bioinspired.hpp
drwxr-sr-x 2 root staff 4096 Jul 11 10:09 calib3d
-rw-r--r-- 1 root staff 182569 Jun 11 10:13 calib3d.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 ccalib
-rw-r--r-- 1 root staff 6910 Jun 12 08:43 ccalib.hpp
drwxr-sr-x 7 root staff 4096 Jul 11 10:09 core
-rw-r--r-- 1 root staff 5550 Jun 12 08:43 core_detect.hpp
-rw-r--r-- 1 root staff 151515 Jun 11 10:13 core.hpp
-rw-r--r-- 1 root staff 3417 Jul 11 09:32 cvconfig.h
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 datasets
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 dnn
-rw-r--r-- 1 root staff 3347 Jun 11 10:13 dnn.hpp
-rw-r--r-- 1 root staff 6805 Jun 12 08:43 dpm.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 face
-rw-r--r-- 1 root staff 17092 Jun 12 08:43 face.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 features2d
-rw-r--r-- 1 root staff 65434 Jun 11 10:13 features2d.hpp
drwxr-sr-x 2 root staff 4096 Jul 11 10:09 flann
-rw-r--r-- 1 root staff 26646 Jul 11 09:30 flann.hpp
-rw-r--r-- 1 root staff 6900 Jun 12 08:43 freetype.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 fuzzy
-rw-r--r-- 1 root staff 3385 Jun 12 08:43 fuzzy.hpp
drwxr-sr-x 8 root staff 4096 Jul 11 10:09 gapi
-rw-r--r-- 1 root staff 932 Jul 11 09:30 gapi.hpp
-rw-r--r-- 1 root staff 6177 Jun 12 08:43 hfs.hpp
drwxr-sr-x 2 root staff 4096 Jul 11 10:09 highgui
-rw-r--r-- 1 root staff 36215 Jun 11 10:13 highgui.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 imgcodecs
-rw-r--r-- 1 root staff 16443 Jun 11 10:13 imgcodecs.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 img_hash
-rw-r--r-- 1 root staff 2965 Jun 12 08:43 img_hash.hpp
drwxr-sr-x 4 root staff 4096 Jul 11 10:09 imgproc
-rw-r--r-- 1 root staff 228365 Jun 11 10:13 imgproc.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 line_descriptor
-rw-r--r-- 1 root staff 6834 Jun 12 08:43 line_descriptor.hpp
drwxr-sr-x 2 root staff 4096 Jul 11 10:09 ml
-rw-r--r-- 1 root staff 92264 Jun 11 10:13 ml.hpp
drwxr-sr-x 2 root staff 4096 Jul 11 10:09 objdetect
-rw-r--r-- 1 root staff 36007 Jun 11 10:13 objdetect.hpp
-rw-r--r-- 1 root staff 4503 Aug 13 2018 opencv.hpp
-rw-r--r-- 1 root staff 752 Jul 11 09:32 opencv_modules.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 optflow
-rw-r--r-- 1 root staff 14276 Jun 12 08:43 optflow.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 phase_unwrapping
-rw-r--r-- 1 root staff 3196 Jun 12 08:43 phase_unwrapping.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 photo
-rw-r--r-- 1 root staff 37887 Jun 11 10:13 photo.hpp
-rw-r--r-- 1 root staff 5346 Jun 12 08:43 plot.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 quality
-rw-r--r-- 1 root staff 469 Jun 12 08:43 quality.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 reg
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 rgbd
-rw-r--r-- 1 root staff 669 Jun 12 08:43 rgbd.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 saliency
-rw-r--r-- 1 root staff 4302 Jun 12 08:43 saliency.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 shape
-rw-r--r-- 1 root staff 2461 Jun 12 08:43 shape.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 stereo
-rw-r--r-- 1 root staff 14356 Jun 12 08:43 stereo.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 stitching
-rw-r--r-- 1 root staff 13772 Jun 11 10:13 stitching.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 structured_light
-rw-r--r-- 1 root staff 3525 Jun 12 08:43 structured_light.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 superres
-rw-r--r-- 1 root staff 8287 Jun 12 08:43 superres.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 surface_matching
-rw-r--r-- 1 root staff 22598 Jun 12 08:43 surface_matching.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 text
-rw-r--r-- 1 root staff 5230 Jun 12 08:43 text.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 tracking
-rw-r--r-- 1 root staff 11893 Jun 12 08:43 tracking.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 video
-rw-r--r-- 1 root staff 2544 Aug 13 2018 video.hpp
drwxr-sr-x 3 root staff 4096 Jul 11 10:09 videoio
-rw-r--r-- 1 root staff 54206 Jun 11 10:13 videoio.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 videostab
-rw-r--r-- 1 root staff 3674 Jun 12 08:43 videostab.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 xfeatures2d
-rw-r--r-- 1 root staff 41604 Jun 12 08:43 xfeatures2d.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 ximgproc
-rw-r--r-- 1 root staff 9756 Jun 12 08:43 ximgproc.hpp
-rw-r--r-- 1 root staff 3445 Jun 12 08:43 xobjdetect.hpp
drwxr-sr-x 2 root staff 4096 Jun 12 10:23 xphoto
-rw-r--r-- 1 root staff 2508 Jun 12 08:43 xphoto.hpp
root#debian:/usr/local#
What should i do to solve this Problem?
Thanks!

I think the problem is with the way make processes the target $(OBJ_CF). That expands to...
./Classificator/Classificator.o
which doesn't match the defined rule...
$(BIN)%.o: $(SOURCE)%.cpp
Hence make will fall back on the builtin rule to compile a c++ file which will invoke...
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c
So either define your own rule for ./Classificator/Classificator.o or set CPPFLAGS accordingly...
CPPFLAGS += -I/usr/local/include/opencv4

Related

How do I fix ln -s not working in Docker?

Step 3/10 : RUN mkdir -p /etc/nginx/{sites-available,sites-enabled}
Step 4/10 : COPY nginx.conf /etc/nginx/
Step 5/10 : COPY sites-available/*.conf /etc/nginx/sites-available/
Step 6/10 : RUN ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
---> Running in a2f39a3fd6b3
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
The command '/bin/sh -c ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/*' returned a non-zero code: 1
Any clue why this isn't working? ^^
I tried all these commands outside of a docker container and it seemed to work
This could be solved by copying the files directly to the sites-enabled directory with the following statement:
COPY sites-available/*.conf /etc/nginx/sites-enabled/
Your step 3 includes a bashism:
mkdir -p /etc/nginx/{sites-available,sites-enabled}
With the default /bin/sh, this will create a single directory rather than the two directories you wanted:
$ docker run -it --rm nginx /bin/sh
# ls -al /etc/nginx
total 48
drwxr-xr-x 3 root root 4096 Dec 28 15:20 .
drwxr-xr-x 1 root root 4096 Jan 26 19:46 ..
drwxr-xr-x 2 root root 4096 Dec 28 15:20 conf.d
-rw-r--r-- 1 root root 1007 Nov 19 12:50 fastcgi_params
-rw-r--r-- 1 root root 2837 Nov 19 12:50 koi-utf
-rw-r--r-- 1 root root 2223 Nov 19 12:50 koi-win
-rw-r--r-- 1 root root 5231 Nov 19 12:50 mime.types
lrwxrwxrwx 1 root root 22 Nov 19 12:50 modules -> /usr/lib/nginx/modules
-rw-r--r-- 1 root root 643 Nov 19 12:50 nginx.conf
-rw-r--r-- 1 root root 636 Nov 19 12:50 scgi_params
-rw-r--r-- 1 root root 664 Nov 19 12:50 uwsgi_params
-rw-r--r-- 1 root root 3610 Nov 19 12:50 win-utf
# mkdir -p /etc/nginx/{sites-available,sites-enabled}
# ls -al /etc/nginx
total 56
drwxr-xr-x 1 root root 4096 Jan 26 19:47 .
drwxr-xr-x 1 root root 4096 Jan 26 19:46 ..
drwxr-xr-x 2 root root 4096 Dec 28 15:20 conf.d
-rw-r--r-- 1 root root 1007 Nov 19 12:50 fastcgi_params
-rw-r--r-- 1 root root 2837 Nov 19 12:50 koi-utf
-rw-r--r-- 1 root root 2223 Nov 19 12:50 koi-win
-rw-r--r-- 1 root root 5231 Nov 19 12:50 mime.types
lrwxrwxrwx 1 root root 22 Nov 19 12:50 modules -> /usr/lib/nginx/modules
-rw-r--r-- 1 root root 643 Nov 19 12:50 nginx.conf
-rw-r--r-- 1 root root 636 Nov 19 12:50 scgi_params
-rw-r--r-- 1 root root 664 Nov 19 12:50 uwsgi_params
-rw-r--r-- 1 root root 3610 Nov 19 12:50 win-utf
drwxr-xr-x 2 root root 4096 Jan 26 19:47 {sites-available,sites-enabled}
For /bin/sh, you need to list them individually:
# mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
# ls -al /etc/nginx
total 64
drwxr-xr-x 1 root root 4096 Jan 26 19:49 .
drwxr-xr-x 1 root root 4096 Jan 26 19:46 ..
drwxr-xr-x 2 root root 4096 Dec 28 15:20 conf.d
-rw-r--r-- 1 root root 1007 Nov 19 12:50 fastcgi_params
-rw-r--r-- 1 root root 2837 Nov 19 12:50 koi-utf
-rw-r--r-- 1 root root 2223 Nov 19 12:50 koi-win
-rw-r--r-- 1 root root 5231 Nov 19 12:50 mime.types
lrwxrwxrwx 1 root root 22 Nov 19 12:50 modules -> /usr/lib/nginx/modules
-rw-r--r-- 1 root root 643 Nov 19 12:50 nginx.conf
-rw-r--r-- 1 root root 636 Nov 19 12:50 scgi_params
drwxr-xr-x 2 root root 4096 Jan 26 19:49 sites-available
drwxr-xr-x 2 root root 4096 Jan 26 19:49 sites-enabled
-rw-r--r-- 1 root root 664 Nov 19 12:50 uwsgi_params
-rw-r--r-- 1 root root 3610 Nov 19 12:50 win-utf
drwxr-xr-x 2 root root 4096 Jan 26 19:47 {sites-available,sites-enabled}

Microsoft.AspNetCore.App 2.2.7 not found in Docker image built from project using Paket

I have a docker image built from an F# project that uses Paket. At run time the image fails with:
It was not possible to find any compatible framework version The
specified framework 'Microsoft.AspNetCore.App', version '2.2.7' was
not found.
My dockerfile looks like this:
# Two stage build because Paket means project files reference external files
# via <Import Project="..\.paket\Paket.Restore.targets" />
# https://github.com/fsprojects/Paket/issues/3006#issuecomment-359750323
FROM microsoft/dotnet:2.2-sdk-alpine AS build
RUN apk update \
&& apk add --no-cache bash
WORKDIR /app
# copy fsproj and restore as distinct layers
COPY MyCompany.WebApi/MyCompany.WebApi.fsproj ./MyCompany.WebApi/
COPY NuGet.config ./
RUN dotnet restore MyCompany.WebApi/MyCompany.WebApi.fsproj --configfile NuGet.config
# copy everything else and build
COPY . ./
RUN dotnet publish MyCompany.WebApi/MyCompany.WebApi.fsproj -c Release -o out
# build runtime image
FROM microsoft/dotnet:2.2-sdk-alpine AS final
RUN apk update \
&& apk add --no-cache bash
WORKDIR /app
COPY --from=build /app/MyCompany.WebApi/out ./
ENTRYPOINT ["dotnet", "MyCompany.WebApi.dll"]
Same problem occurs if I use 2.2-runtime-alpine as the basis for final.
My packet.lock includes these lines:
// https://github.com/fsharp/FAKE/issues/2193:
version 5.216.0
...
source https://api.nuget.org/v3/index.json
...
nuget Microsoft.AspNetCore.App
...
I notice that my generated paket.dependencies specifies a particular version of Microsoft.AspNetCore.App:
Microsoft.AspNetCore.App (2.2.7)
Microsoft.AspNet.WebApi.Client (>= 5.2.6 < 5.3) - restriction: >= netcoreapp2.2
Microsoft.AspNetCore (>= 2.2 < 2.3) - restriction: >= netcoreapp2.2
Microsoft.AspNetCore.Antiforgery (>= 2.2 < 2.3) - restriction: >= netcoreapp2.2
...although it looks like we are discouraged from specifying versions:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/metapackage-app?view=aspnetcore-2.2
So my question is: is it possible to come up with a combination of Docker, Paket, F# and AspNetCore that works together?
Edit: paket.dependencies -> packet.lock
Edit 2: Here's a listing of the entry point's directory and below:
.:
total 18668
-rwxr--r-- 1 root root 190976 Aug 29 13:18 Dapper.dll
-rwxr--r-- 1 root root 2850168 Aug 2 19:03 FSharp.Core.dll
-rwxr--r-- 1 root root 243200 Apr 16 08:00 Fable.Core.dll
-rwxr--r-- 1 root root 342528 Feb 10 2019 Giraffe.dll
...lots more DLLs from Nuget dependencies
... some DLLs from our internal dependencies
-rw-r--r-- 1 root root 100670 Sep 12 13:23 MyCompany.WebApi.deps.json
-rwxr-xr-x 1 root root 61440 Sep 12 13:23 MyCompany.WebApi.dll
-rw-r--r-- 1 root root 10608 Sep 12 13:23 MyCompany.WebApi.pdb
-rw-r--r-- 1 root root 149 Sep 12 13:23 MyCompany.WebApi.runtimeconfig.json
-rwxr--r-- 1 root root 178824 Nov 28 2018 System.Net.Http.Formatting.dll
-rwxr--r-- 1 root root 23088 Sep 18 2018 System.Runtime.CompilerServices.Unsafe.dll
-rwxr--r-- 1 root root 29744 Feb 15 2019 System.Security.Cryptography.OpenSsl.dll
-rwxr--r-- 1 root root 189168 Nov 29 2018 System.Security.Cryptography.Pkcs.dll
-rwxr--r-- 1 root root 29760 Jul 19 2018 System.ServiceModel.Primitives.dll
-rwxr--r-- 1 root root 30784 Jul 19 2018 System.ServiceModel.dll
-rwxr--r-- 1 root root 759024 Nov 29 2018 System.Text.Encoding.CodePages.dll
-rwxr--r-- 1 root root 91136 Sep 16 2018 TaskBuilder.fs.dll
drwxr-xr-x 2 root root 4096 Sep 12 13:23 cs
drwxr-xr-x 2 root root 4096 Sep 12 13:23 de
drwxr-xr-x 2 root root 4096 Sep 12 13:23 es
drwxr-xr-x 2 root root 4096 Sep 12 13:23 fr
drwxr-xr-x 2 root root 4096 Sep 12 13:23 it
drwxr-xr-x 2 root root 4096 Sep 12 13:23 ja
drwxr-xr-x 2 root root 4096 Sep 12 13:23 ko
drwxr-xr-x 2 root root 4096 Sep 12 13:23 pl
-rwxr--r-- 1 root root 277504 Aug 30 2018 protobuf-net.dll
drwxr-xr-x 2 root root 4096 Sep 12 13:23 pt-BR
drwxr-xr-x 2 root root 4096 Sep 12 13:23 ru
drwxr-xr-x 4 root root 4096 Sep 12 13:23 runtimes
drwxr-xr-x 2 root root 4096 Sep 12 13:23 tr
drwxr-xr-x 2 root root 4096 Sep 12 13:23 zh-Hans
drwxr-xr-x 2 root root 4096 Sep 12 13:23 zh-Hant
./cs:
total 376
-rwxr--r-- 1 root root 33144 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 308088 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 34896 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./de:
total 392
-rwxr--r-- 1 root root 34168 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 327544 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 36216 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./es:
total 388
-rwxr--r-- 1 root root 33360 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 321104 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 35920 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./fr:
total 392
-rwxr--r-- 1 root root 33656 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 327544 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 36432 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./it:
total 392
-rwxr--r-- 1 root root 33144 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 325496 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 36216 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./ja:
total 428
-rwxr--r-- 1 root root 35704 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 358776 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 38264 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./ko:
total 396
-rwxr--r-- 1 root root 34680 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 331336 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 36728 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./pl:
total 396
-rwxr--r-- 1 root root 34168 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 331128 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 36216 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./pt-BR:
total 380
-rwxr--r-- 1 root root 32632 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 316280 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 35704 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./ru:
total 508
-rwxr--r-- 1 root root 39800 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 430968 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 42360 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./runtimes:
total 8
drwxr-xr-x 3 root root 4096 Sep 12 13:23 unix
drwxr-xr-x 3 root root 4096 Sep 12 13:23 win
./runtimes/unix:
total 4
drwxr-xr-x 4 root root 4096 Sep 12 13:23 lib
./runtimes/unix/lib:
total 8
drwxr-xr-x 2 root root 4096 Sep 12 13:23 netcoreapp2.1
drwxr-xr-x 2 root root 4096 Sep 12 13:23 netstandard2.0
./runtimes/unix/lib/netcoreapp2.1:
total 88
-rwxr--r-- 1 root root 86280 Feb 15 2019 System.Security.Cryptography.OpenSsl.dll
./runtimes/unix/lib/netstandard2.0:
total 1848
-rwxr--r-- 1 root root 1889344 Jul 19 2018 System.Private.ServiceModel.dll
./runtimes/win:
total 4
drwxr-xr-x 5 root root 4096 Sep 12 13:23 lib
./runtimes/win/lib:
total 12
drwxr-xr-x 2 root root 4096 Sep 12 13:23 netcoreapp2.0
drwxr-xr-x 2 root root 4096 Sep 12 13:23 netcoreapp2.1
drwxr-xr-x 2 root root 4096 Sep 12 13:23 netstandard2.0
./runtimes/win/lib/netcoreapp2.0:
total 744
-rwxr--r-- 1 root root 761392 Nov 29 2018 System.Text.Encoding.CodePages.dll
./runtimes/win/lib/netcoreapp2.1:
total 212
-rwxr--r-- 1 root root 214064 Nov 29 2018 System.Security.Cryptography.Pkcs.dll
./runtimes/win/lib/netstandard2.0:
total 1848
-rwxr--r-- 1 root root 1889344 Jul 19 2018 System.Private.ServiceModel.dll
./tr:
total 376
-rwxr--r-- 1 root root 32632 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 312184 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 35192 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./zh-Hans:
total 344
-rwxr--r-- 1 root root 31096 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 278904 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 33144 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
./zh-Hant:
total 344
-rwxr--r-- 1 root root 30584 Aug 2 19:03 FSharp.Core.resources.dll
-rwxr--r-- 1 root root 280144 Aug 8 16:19 Microsoft.CodeAnalysis.CSharp.resources.dll
-rwxr--r-- 1 root root 33360 Aug 8 16:18 Microsoft.CodeAnalysis.resources.dll
I think I've fixed this. Changed the base image to one I found referenced in a Microsoft tutorial, and removed the apk update stage (as this returned a non-zero exit code with this new base image). So this is my dockerfile now.
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
WORKDIR /app
# copy fsproj and restore as distinct layers
COPY MyCompany.WebApi/MyCompany.WebApi.fsproj ./MyCompany.WebApi/
COPY NuGet.config ./
RUN dotnet restore MyCompany.WebApi/MyCompany.WebApi.fsproj --configfile NuGet.config
# copy everything else and build
COPY . ./
RUN dotnet publish MyCompany.WebApi/MyCompany.WebApi.fsproj -c Release -o out
# build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS final
WORKDIR /app
COPY --from=build /app/MyCompany.WebApi/out ./
ENTRYPOINT ["dotnet", "MyCompany.WebApi.dll"]
It starts up OK now, haven't yet tested the functionality!
I am far from a Docker or Linux expert, but I would hazard a guess that the Alpine image hasn't caught up with the latest dotnet releases. I would also guess that the image I create after this change is fatter than it needs to be, but I'll take 'fat and working' for now.

Folder created with Docker RUN command keeps disappearing

Dockerfile contents:
# Setup directory structure
RUN mkdir -p /dev/log/ \
&& touch /dev/log/placeholder.file \
&& ls -la /dev/
As you can see below, the /dev/log/ folder is conspicuously missing from the actual container after being visible in the docker build output. Where is it going? Is /dev/ considered a special folder?
docker build output:
Step 13/14 : RUN mkdir -p /dev/log/ && touch /dev/log/placeholder.file && ls -la /dev/
---> Running in ac5014b75a54
total 4
drwxr-xr-x 6 root root 360 Oct 17 15:04 .
drwxr-xr-x 1 root root 4096 Oct 17 15:04 ..
lrwxrwxrwx 1 root root 11 Oct 17 15:04 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Oct 17 15:04 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Oct 17 15:04 full
drwxr-xr-x 2 root root 60 Oct 17 15:04 log
drwxrwxrwt 2 root root 40 Oct 17 15:04 mqueue
crw-rw-rw- 1 root root 1, 3 Oct 17 15:04 null
lrwxrwxrwx 1 root root 8 Oct 17 15:04 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Oct 17 15:04 pts
crw-rw-rw- 1 root root 1, 8 Oct 17 15:04 random
drwxrwxrwt 2 root root 40 Oct 17 15:04 shm
lrwxrwxrwx 1 root root 15 Oct 17 15:04 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Oct 17 15:04 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Oct 17 15:04 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Oct 17 15:04 tty
crw-rw-rw- 1 root root 1, 9 Oct 17 15:04 urandom
crw-rw-rw- 1 root root 1, 5 Oct 17 15:04 zero
---> 2bdcd739e2c7
Removing intermediate container ac5014b75a54
View from inside the container:
docker run -it --rm <container> /bin/bash
[root#moby dev]# ls -al
total 4
drwxr-xr-x 5 root root 360 Oct 17 15:19 .
drwxr-xr-x 1 root root 4096 Oct 17 15:19 ..
crw--w---- 1 root tty 136, 0 Oct 17 2017 console
lrwxrwxrwx 1 root root 11 Oct 17 15:19 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Oct 17 15:19 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Oct 17 15:19 full
drwxrwxrwt 2 root root 40 Oct 17 15:19 mqueue
crw-rw-rw- 1 root root 1, 3 Oct 17 15:19 null
lrwxrwxrwx 1 root root 8 Oct 17 15:19 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Oct 17 15:19 pts
crw-rw-rw- 1 root root 1, 8 Oct 17 15:19 random
drwxrwxrwt 2 root root 40 Oct 17 15:19 shm
lrwxrwxrwx 1 root root 15 Oct 17 15:19 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Oct 17 15:19 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Oct 17 15:19 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Oct 17 15:19 tty
crw-rw-rw- 1 root root 1, 9 Oct 17 15:19 urandom
crw-rw-rw- 1 root root 1, 5 Oct 17 15:19 zero
Is /dev/ considered a special folder?
Short answer, yes. It is a special folder and you shouldn't store stuff there. What is happening is that /dev gets mounted at container runtime, which is overwriting your folder:
$ docker run ubuntu mount | grep "/dev"
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
You will need to choose another place to store files or create the folder at runtime so that it happens after the mount.

Xcode fails to compile for real iPad but works for simulator (missing header files in netinet)

Xcode version 6.2 building for iOS 8.2. I have an application that builds and runs in the iphone and ipad simulator but when I try to build and deploy to a real i-device the compile fails.
The header files under netinet in these 2 directories are vastly different:
`
ls -al /Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/netinet
total 40
drwxr-xr-x 6 root wheel 204 Mar 19 11:02 ./
drwxr-xr-x 154 root wheel 5236 Mar 19 11:01 ../
-rw-r--r-- 1 root wheel 27431 Mar 10 11:29 in.h
-rw-r--r-- 1 root wheel 4001 Mar 10 11:29 in_systm.h
-rw-r--r-- 1 root wheel 8097 Mar 10 11:29 ip.h
-rw-r--r-- 1 root wheel 8946 Mar 10 11:29 tcp.h
`
ls -al /Applications/Xcode.app//Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/netinet
total 72
drwxr-xr-x 24 root wheel 816 Feb 10 00:56 ./
drwxr-xr-x 206 root wheel 7004 Mar 10 11:31 ../
-rw-r--r-- 1 root wheel 4165 Mar 10 11:30 bootp.h
-rw-r--r-- 1 root wheel 24679 Mar 10 11:30 icmp6.h
-rw-r--r-- 1 root wheel 4577 Mar 10 11:30 icmp_var.h
-rw-r--r-- 1 root wheel 5832 Mar 10 11:30 if_ether.h
-rw-r--r-- 1 root wheel 7093 Mar 10 11:30 igmp.h
-rw-r--r-- 1 root wheel 5839 Mar 10 11:30 igmp_var.h
-rw-r--r-- 1 root wheel 27431 Mar 10 11:30 in.h
-rw-r--r-- 1 root wheel 9496 Mar 10 11:30 in_pcb.h
-rw-r--r-- 1 root wheel 4001 Mar 10 11:30 in_systm.h
-rw-r--r-- 1 root wheel 5574 Mar 10 11:30 in_var.h
-rw-r--r-- 1 root wheel 8097 Mar 10 11:30 ip.h
-rw-r--r-- 1 root wheel 11034 Mar 10 11:30 ip6.h
-rw-r--r-- 1 root wheel 9471 Mar 10 11:30 ip_icmp.h
-rw-r--r-- 1 root wheel 6237 Mar 10 11:30 ip_var.h
-rw-r--r-- 1 root wheel 8946 Mar 10 11:30 tcp.h
-rw-r--r-- 1 root wheel 5181 Mar 10 11:30 tcp_fsm.h
-rw-r--r-- 1 root wheel 4484 Mar 10 11:30 tcp_seq.h
-rw-r--r-- 1 root wheel 6772 Mar 10 11:30 tcp_timer.h
-rw-r--r-- 1 root wheel 22554 Mar 10 11:30 tcp_var.h
-rw-r--r-- 1 root wheel 4271 Mar 10 11:30 tcpip.h
-rw-r--r-- 1 root wheel 3694 Mar 10 11:30 udp.h
-rw-r--r-- 1 root wheel 5659 Mar 10 11:30 udp_var.h
I can work around it by creating links that point to the simulator header files but that feels wrong.
Is there a reason for what I'm seeing?

Issue with docker-py in executing /bin/bash

I have a docker image built from ubuntu base image with few softwares installed.
i have a startup script, as below
#!/bin/bash
/usr/local/sbin/process1 -d
/usr/local/sbin/process2 -d
/bin/bash
Now I use docker-py python library to start multiple of these containers from a python file.
c = docker.Client(base_url='unix://var/run/docker.sock',
version='1.12',
timeout=10)
container = c.create_container("p12", command="/startup.sh", hostname=None, user=None,
detach=False, stdin_open=False, tty=False, mem_limit=0,
ports=None, environment=None, dns=None, volumes=None,
volumes_from=None, network_disabled=False, name=None,
entrypoint=None, cpu_shares=None, working_dir=None,
memswap_limit=0)
c.start(container, binds=None, port_bindings=None, lxc_conf=None,
publish_all_ports=False, links=None, privileged=False,
dns=None, dns_search=None, volumes_from=None, network_mode=None,
restart_policy=None, cap_add=None, cap_drop=None)
This worked fine and I can start multiple (say 3) when I tested this on a Ubuntu Desktop, Ubuntu 14.04.1 LTS and with docker-py version of 1.10. It will start the dockers and I can do a docker attach later and work on the terminal.
Now i moved my testing environment to a Ubuntu Server edition with Ubuntu 14.04.1 LTS and with docker-py version of 1.12.
The issue i see is that, when I use the same script and try to start 3 dockers, after starting process1 and process 2 as background processes, all the dockers simply exit. It appears as if /bin/bash doesnt execute at all.
If i execute the same docker image as "docker run -t -i p14 /startup.sh --> then everything is fine again. The docker is started appropriately and i get the terminal access.
The only issue is when i execute this python library.
anybody has any similar issues...any idea on how to debug this problem...or any pointers for the fix ?
Thanks,
Kiran
The difference is you're in tty (-t) mode with an open stdin (-i) when you run your docker image with docker run -t -i p14 /startup.sh, whereas you set both stdin_open=False and tty=False in your docker-py configuration.
Because your docker container has no tty and can't take any input from stdin, your call to /bin/bash has nothing to do so exits with code 0.
Try it yourself:
An open stdin with a tty
$ docker run -t -i ubuntu:14.04 /bin/bash
root#1e7eda2bba03:/# ls -la
total 7184
drwxr-xr-x 21 root root 4096 Sep 19 21:30 .
drwxr-xr-x 21 root root 4096 Sep 19 21:30 ..
-rwxr-xr-x 1 root root 0 Sep 19 21:30 .dockerenv
-rwx------ 1 root root 7279686 Jul 21 10:50 .dockerinit
drwxr-xr-x 2 root root 4096 Sep 3 03:33 bin
drwxr-xr-x 2 root root 4096 Apr 10 22:12 boot
drwxr-xr-x 4 root root 360 Sep 19 21:30 dev
drwxr-xr-x 61 root root 4096 Sep 19 21:30 etc
drwxr-xr-x 2 root root 4096 Apr 10 22:12 home
drwxr-xr-x 12 root root 4096 Sep 3 03:33 lib
drwxr-xr-x 2 root root 4096 Sep 3 03:33 lib64
drwxr-xr-x 2 root root 4096 Sep 3 03:33 media
drwxr-xr-x 2 root root 4096 Apr 10 22:12 mnt
drwxr-xr-x 2 root root 4096 Sep 3 03:33 opt
dr-xr-xr-x 240 root root 0 Sep 19 21:30 proc
drwx------ 2 root root 4096 Sep 3 03:33 root
drwxr-xr-x 7 root root 4096 Sep 3 03:33 run
drwxr-xr-x 2 root root 4096 Sep 4 18:41 sbin
drwxr-xr-x 2 root root 4096 Sep 3 03:33 srv
dr-xr-xr-x 13 root root 0 Sep 19 18:44 sys
drwxrwxrwt 2 root root 4096 Sep 4 18:41 tmp
drwxr-xr-x 10 root root 4096 Sep 3 03:33 usr
drwxr-xr-x 11 root root 4096 Sep 3 03:33 var
root#1e7eda2bba03:/#
An open stdin with no tty (i.e., no prompt, but you can still send commands via stdin)
$ docker run -i ubuntu:14.04 /bin/bash
ls -la
total 7184
drwxr-xr-x 21 root root 4096 Sep 19 21:32 .
drwxr-xr-x 21 root root 4096 Sep 19 21:32 ..
-rwxr-xr-x 1 root root 0 Sep 19 21:32 .dockerenv
-rwx------ 1 root root 7279686 Jul 21 10:50 .dockerinit
drwxr-xr-x 2 root root 4096 Sep 3 03:33 bin
drwxr-xr-x 2 root root 4096 Apr 10 22:12 boot
drwxr-xr-x 4 root root 340 Sep 19 21:32 dev
drwxr-xr-x 61 root root 4096 Sep 19 21:32 etc
drwxr-xr-x 2 root root 4096 Apr 10 22:12 home
drwxr-xr-x 12 root root 4096 Sep 3 03:33 lib
drwxr-xr-x 2 root root 4096 Sep 3 03:33 lib64
drwxr-xr-x 2 root root 4096 Sep 3 03:33 media
drwxr-xr-x 2 root root 4096 Apr 10 22:12 mnt
drwxr-xr-x 2 root root 4096 Sep 3 03:33 opt
dr-xr-xr-x 243 root root 0 Sep 19 21:32 proc
drwx------ 2 root root 4096 Sep 3 03:33 root
drwxr-xr-x 7 root root 4096 Sep 3 03:33 run
drwxr-xr-x 2 root root 4096 Sep 4 18:41 sbin
drwxr-xr-x 2 root root 4096 Sep 3 03:33 srv
dr-xr-xr-x 13 root root 0 Sep 19 18:44 sys
drwxrwxrwt 2 root root 4096 Sep 4 18:41 tmp
drwxr-xr-x 10 root root 4096 Sep 3 03:33 usr
drwxr-xr-x 11 root root 4096 Sep 3 03:33 var
A closed stdin with a tty (you can see the prompt but you can't enter any commands)
$ docker run -t ubuntu:14.04 /bin/bash
root#95904c21e5a5:/# ls -la
hello
this does nothing :(
A closed stdin with no tty - /bin/bash has nothing to do
$ docker run ubuntu:14.04 /bin/bash
$

Resources