I am using Docker to develop an Elixir umbrella app. I have one umbrella app and inside a Phoenix app. When I start the code locally with mix phx.server everything works. When I do the same inside the Docker container (code is synced via docker-sync) I get this error:
(Mix) Could not start application runtime_tools: could not find application file: runtime_tools.app
Any idea on how to fix this?
Turns out erlang-runtime-tools was not installed in my docker image. Adding
RUN apk --update add erlang-runtime-tools
to the dockerfile fixed the issue. Thanks #Alexei Sholik for pointing this out.
Related
I inherited a clojure code base and I'm trying to containerize it for local development. The creators used deps.edn to manage the dependencies. However, I can't figure out what RUN command I should use to pre-install the dependencies for the project.
Currently, my entrypoint is the following ['clj', '-m', 'app'] which installs the dependencies every time I start the container.
How do I pre-install dependencies for a clojure project using a Docker RUN command?
Deps/CLI caching is described here. Generally speaking, dependencies are downloaded once and saved in a subdirectory of the project directory named
./.cpcache # "class path cache"
The ./.cpcache directory is analagous to the ~/.m2 cache directory used by Maven and related tools (e.g. Leiningen).
If you run the code locally, you should be able to copy the .cpcache dir with its cached dependencies into your Docker container. Then the dependencies don't need to be re-downloaded
for each startup of the Docker container.
See also the Deps/CLI overview.
P.S.
This template project is set up to run using both lein and Deps/CLI via the Kaocha tool. You may find the comparison helpful.
P.P.S.
You may find it easiest to run your code by building an uberjar file which contains all your code and all
dependencies in a single artifact. You can do this either using Leiningen or other tools such as depstar. You then invoke the application with a single command like:
java -jar demo-0.1.0-standalone.jar
Running this should do it:
clj -P
I have a .NetCore web API and and need to connect with a C++ shared library (libCppAppOutput.so). For this I am using DllImport inside the controller of the Web API as in the below code:
[DllImport("libCppAppOutput.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "methodNameinCppProject")]
public static extern int MethodNameInWebAPI(string param1, string param2);
When I am debugging it in Visual studio with Windows environment, I am getting an exception like
An attempt was made to load a program with an incorrect format.
(0x8007000B).
This may be because of trying to access a Linux file in Windows environment, if I am using a CppAppOutput.dll in place of libCppAppOutput.so I can successfully call the methods inside the dll. But my actual requirement is to run the entire application in Linux environment and to be proceed with .so file only, so I have created a docker image with target OS as Linux and tried to call the methods inside it from running docker with the below command :
docker run -p 8081:80 name_of_docker_image:tagname
Then I am getting an exception like:
Unable to load shared library 'libCppAppOutput.so' or one of its dependencies. In order to help diagnose loading problems, consider
setting the LD_DEBUG environment variable: libCppAppOutput.so: cannot
open shared object file: No such file or directory.
But I can see the file, libCppAppOutput.so is present inside the docker image by using the following commands,
docker create --name name_of_container name_of_docker_image:tagname
docker start name_of_container
docker exec -ti name_of_container /bin/bash
root#xyzabc:/app# ls
I am using below URL to test the application
http://localhost:8081/launchUrl/MethodNameInWebAPI/param1/param2
Please help me in this regard like how can I call a .so file from the Linux docker.
if this issue to be elaborated more, kindly comment and I will do.
Thanks in advance.
I could able to solve this issue with help from my colleagues and friends.
There was a dependency with libCppAppOutput.so (an XML parser). Even though that dependency package is installed in the container, it was missed to configure while creating the libCppAppOutput.so.
This was identified by executing ldl libCppAppOutput.so command in bash.
Thank you all for spend time on reading and analyzing the question !
Have more N more great coding days!
Created a new .NET CORE 2.1 (preview) web app. Running it in local docker with Linux container
I am getting compiler error:
Error Building blobtest
Service 'blobtest' failed to build: manifest for microsoft/aspnetcore:2.1 not found.
My dotnetversion
C:\WINDOWS\system32>dotnet --version
2.1.300-preview2-008530
They have changed the repo for .NET Core 2.1 onwards to microsoft/dotnet.
Change your FROM statement to reference microsoft/dotnet using the following tags:
2.1-sdk
2.1-aspnetcore-runtime
2.1-runtime
Documentation on how to upgrade can be found here
I had this issue as well. I thought I'd update this post to show the fix here. Thanks to Marius Bidireac for the link to the resource.
Here is an excerpt from the original docker file
FROM microsoft/aspnetcore:2.0 AS base
FROM microsoft/aspnetcore-build:2.0 AS build
Here is an excerpt from the corrected docker file
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
FROM microsoft/dotnet:2.1-sdk AS build
If you are using GitLab CI, then these images don't workâmaybe because they changed the names of the images again. See official page on Docker.
If I used the labels suggested by this answer,
image: microsoft/dotnet:2.2
Then, it kept giving the errors,
manifest for microsoft/dotnet:2.2 not found
Solution to this was to use the recent naming convention provided by Microsoft. Please see the Docker link I provided above. In my GitLab CI (.gitlab-ci.yml) file I used the following and it worked,
image: mcr.microsoft.com/dotnet/core/sdk:2.2
Now the build pipeline succeeds just fine.
I followed the Hyperledger fabric documentation to install and configure it in Windows 10. However when I run the command - "./byfn.sh -m generate" for first-network sample application, I get the following error,
I have gone thru all StackOverflow questions regarding this and made sure following steps are done,
Have set the $PATH variable correctly to include bin folder.
Have downloaded the platform-specific binary and my bin folder looks like this,
I have doubts about following steps,
I have installed Docker for Windows and was able to verify the docker installation by running hello-world image in Docker. However, I have not shared any of my local drives in Docker. Not sure whether this is the cause of this error.
Please note that this is my first question in StackOverflow. Forgive me for any mistakes/redundancies. Any help is greatly appreciated.
I'd suggest making sure that you run the script to download / install the binaries and images from within the fabric-samples directory.
The $Path is exported every time you run the byfn.sh script, confirm that the path configuration in the byfn.sh is correct and points to your correct bin location
# prepending $PWD/../bin to PATH to ensure we are picking up the correct binaries
# this may be commented out to resolve installed version of tools if desired
export PATH=${PWD}/../../bin:${PWD}:$PATH
export FABRIC_CFG_PATH=${PWD}
I am trying to add the mod_zeropush module to the existing ejabberd MongooseIm server.
I copied the beam file to location where all beam files are there in the rel folder.
When do the $sudo bin/mongooseimctl debug command and finding the mod_ all entries matching with mod_... I see all except my mod_zeropush.
Can anyone help me how they made this module add to their chat server.
Raised this issue to Github guys as well : MongooseIM GitHub
I achieved this by getting some help and would like share how its added to MongooseIM.
This setup is done on a server running Ubuntu 16.04.
After you downloaded mod_zeropush.erl (maybe from here), put it in the location as mentioned below:
`<GitSourceMongooseFolder>/apps/ejabberd/src/mod_zeropush.erl`
Run sudo make in MongooseIM directory.
After the build is done, the beam file is created in the rel
folder at location given below:
/MongooseIM/rel/mongooseim/lib/ejabberd-2.1.8+mim-2.0.0beta2-312-g3cec442/ebin
Add the following code to ejabberd.cfg in modules section.
{mod_zeropush, [
{sound, "default"},
{auth_token, "myapp-chat-token"},
{post_url, "http://my.url/mypath"}
]},
Go to rel/mongooseim folder and enter the command sudo
bin/mongooseimctl debug
Check by entering mod_ on shell prompt then Tab; you should see
mod_zero
Go to root/rel github directory and sudo bin/mongooseim restart
Done. You should receive offline messages on your web server.