How to solve Docker error code 139 on Manjaro? - docker

I recently installed Manjaro on my Computer and I'm doing a few tests.
I tried to build and lanch a Docker which works perfectly on Windows, Mac Os, Ubuntu, etc.
But when I run sudo docker-compose up I get an error.
Everything seems to work fine except at the end:
Successfully built d72aa4c69ad6
Successfully tagged code_interface:latest
WARNING: Image for service interface was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating code_db_1 ... done
Creating code_web_1 ... done
Creating code_interface_1 ... done
Attaching to code_db_1, code_web_1, code_interface_1
code_db_1 exited with code 139
Here's what my docker-compose.yml looks like:
db:
image: mongo:3.0.2
ports:
- "27017:27017"
web:
build: X
ports:
- "5000:5000"
links:
- db
interface:
build: Y
ports:
- "8080:8080"
links:
- web
Any idea why I get this error or how to fix it ?

This may be related with the kernel version of your computer, like reported in this issue:
This is probably related to the changes in vsyscall linking in the 4.11 kernel. Try booting the kernel with vsyscall=emulate and see if it helps. This does run ok under the linuxkit 4.11 kernel config without issues, so it is to do with the config.
Try to implement the solution from this comment:
Hi, specifying this command in /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="vsyscall=emulate"
Let us know if it solves the issue for you.

as far as i know error 139 is a segmentation fault raised by hardware with memory protection. it tells you that your programm is trying to access a restricted area of memory.
maybe you try to get access to read only memory, got a null pointer dereference anywhere in your code or produced a stack overflow.

Finally made it work.
I had to update my kernel to the last version (from 4.19.16-1 to 4.20.3-1).
Don't really know why though.

Related

Dockerfile Alpine Mariadb latest with SphinxSE

I have a Dockerfile for MariaDB 10.1.26 which I use in connection with SphixSE.
Defining Dockerfiles for versions 10.4.18 and 10.5.9 along the same lines is easy, but SphinxSE cannot be installed.
Specifically the command INSTALL SONAME 'ha_sphinx'; raises an enigmatic error.
What can I do to make it work with these versions, too?
For the time being it cannot be done.
https://git.alpinelinux.org/aports/tree/main/mariadb/APKBUILD#n162 shows that the package does not support SphinxSE.
https://github.com/MariaDB/mariadb-docker/pull/343 shows that MariaDB does not support Alpine.

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction [duplicate]

I just reinstalled Fabric Samples v2.2.0 from Hyperledger Fabric repository according to the documentation.
But when I try to run asset-transfer-basic application located in fabric-samples/asset-transfer-basic/application-javascript directory by running node app.js the wallet is created and an admin and user is registered. But then it tries to invoke the function as given in app.js and shows this error
error: [Transaction]: Error: No valid responses from any peers. Errors:
peer=peer0.org1.example.com:7051, status=500, message=error in simulation: failed to execute transaction
aa705c10403cb65cecbd360c13337d03aac97a8f233a466975773586fe1086f6: could not launch chaincode basic_1.0:b359a077730d7
f44d6a437ad49d1da951f6a01c6d1eed4f85b8b1f5a08617fe7: error starting container: error starting container:
API error (404): network _test not found
Response of a transaction to invoke a function
This error never occured before. But somehow after reinstalling docker and Hyperledger Fabric fabric-samples it never seems to find the network _test.
N.B. : Before reinstalling name of the network was net_test. But now when I try docker network ls it shows a network called docker_test. I am using Windows Subsystem for Linux (WSL) version 1.
NETWORK ID NAME DRIVER SCOPE
b7ac05456f46 bridge bridge local
acaa5856b871 docker_test bridge local
866f58b9078d host host local
4812f94efb15 none null local
How can I fix the issue occurring when I try to run the application?
In my opinion, the CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE setting seems to be wrong.
you can check docker-compose.yaml or core.yaml
1. docker-compose.yaml
I will explain fabric-samples/test-network as targeting according to your current situation.
You can check in CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE in docker-compose.yaml
Perhaps in your case(fabric-samples/test-network), the value of ${COMPOSE_PROJECT_NAME} was not set properly, so it was set to _test.
Make sure the value is set correctly and change it to your network name.
# hyperledger/fabric-samples/test-network/docker/docker-compose-test-net.yaml
# based v2.2
...
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:2.2
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=docker_test
...
2. core.yaml
If you have not set the value in the docker-compose.yaml peer, you need to check the core.yaml referenced by the peer.
you can find the networkMode parameter in core.yaml
# core.yaml
...
vm:
docker:
hostConfig:
# NetworkMode: host
NetworkMode: docker_test
...
If neither is set, it will be set to the default value. However, as you see _test being logged, the wrong value have been set in one of the two section, and you need to correct the value to the value you intended.
This issue is related to docker networking. In complete to #nezuko-response.
Create a file and name it ".env" in the same directory where your docker-compose file exists.
Add the following line in it:
COMPOSE_PROJECT_NAME=net
Use docker-compose up to update the container with the new configurations.
Or bring the HL network down (./network.sh down) and up (./network.sh up), restarting the test-nework.
Otherwise you'll still get the same error even after creating ".env" file.
More explanation about docker networking
run ./network down
then
export COMPOSE_PROJECT_NAME=net
afterwards
./network start
I copied this from someone .This one worked for me !!
Please create a file named ".env" in the same directory where your docker-compose file exists. Add the following line in ".env" file:-
COMPOSE_PROJECT_NAME=net
This worked for me
export COMPOSE_PROJECT_NAME=net

docker-compose service list changes among branches: Service has neither an image nor a build context specified. At least one must be provided

I'm working on a new service on my stack.
So when I work on the new-service branch, I have in docker-compose.yml:
version: "3.6"
services:
app:
image: whatever
new_service:
image: whatever
I do docker-compose up and start working.
But then I sometimes need to make hot fixes on the master branch, where new_service is not there.
When I try to do docker-compose up, I get the following error:
ERROR: The Compose file is invalid because:
Service new_service has neither an image nor a build context specified. At least one must be provided.
I guess, I could edit my docker-compose.yml file to add fake new_service entry only to start my server, but that's not an acceptable solution to me.
Shouldn't docker-compose re-read the service list on every start? Or can't I at least force the refresh like docker-compose up --reset?
Ok my bad.
docker-compose does work as expected, but I had a
service:
new_service:
command: yarn dev
entry in my docker-compose.override.yml which is .gitignored, hence the error.
I wanted to delete the question, but then I considered others may do the mistake, and landing here would help them too.
We'll see. :-)

Microservices: What is the ESHOP_OCELOT_VOLUME_SPEC line mean in docker.compose file

I am looking at the code in eShopOnContainer under the docker-compose.override.yml. I can see a line in
volumes:
- ./src/ApiGateways/Web.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
webshoppingapigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- IdentityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
ports:
- "5202:80"
volumes:
- ./src/ApiGateways/Web.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
What does the line in the volumes ${ESHOP_OCELOT_VOLUME_SPEC .. is? I would think it will create a volumes of something but the ${ESHOP_OCELOT_VOLUME_SPEC … I can't see where it define in the project even not inside the .env file.
When I went inside the docker-compose.override.prod, the line ${ESHOP_OCELOT_VOLUME not even there.
Currently I have exception running the sample code, therefore I tried to do follow the code from eShopOnContainer but code a simple version so I can easily to follow. I start doing the ApiGateway and building up from there.
I don't know is this question eligible to be asked. People here very fuzzy of the question.
volumes: - ./src/ApiGateways/Web.Bff.Shopping/apigw:${ESHOP_OCELOT_VOLUME_SPEC:-/app/configuration}
That means:
Mount the ./src/ApiGateways/Web.Bff.Shopping/apigw to the path mentioned by $ESHOP_OCELOT_VOLUME_SPEC
If $ESHOP_OCELOT_VOLUME_SPEC is empty (not defined), then use as a mount path /app/configuration.
That gives the opportunity to a user to override the default path by a path of his/her choosing.
docker run -e ESHOP_OCELOT_VOLUME_SPEC=/my/path ...
ESHOP_OCELOT_VOLUME_SPEC which is an environment variable. The variable value may be exported/set in some place of the code or in the instance. ESHOP_OCELOT_VOLUME_SPEC will be replaced with value, that's why you where not able to see ESHOP_OCELOT_VOLUME_SPEC in docker instead the value in ESHOP_OCELOT_VOLUME_SPEC.

How to correctly setup swap/memory-limits for docker?

I ran a docker container with -m 1800m and got a warning related to memory-swappiness capabilities and suchlike (I forget the exact warning because I don't see it now). Here's a similar warning I found on the internet:
WARNING: Your kernel does not support memory swappiness capabilities,
memory swappiness discarded.
After a bunch of Googling around I found the check-config script to check whether my system/kernel was setup for running Docker properly. Most of the things were reported "green", but the following were reported "red":
Optional Features:
- CONFIG_USER_NS: enabled
- CONFIG_SECCOMP: enabled
- CONFIG_CGROUP_PIDS: enabled
- CONFIG_MEMCG_SWAP: enabled
- CONFIG_MEMCG_SWAP_ENABLED: missing <=====
- CONFIG_RT_GROUP_SCHED: missing <=====
- "zfs":
- /dev/zfs: missing <====
- zfs command: missing <====
- zpool command: missing <====
More Googling landed my on this article. I followed the instructions given there and rebooted my kernel after appending the following params to the grub config/command-line:
cgroup_enable=memory swapaccount=1
Now, when I run the docker command with -m 1800m I don't see that warning, which is good. However, the check-config script still shows up the same things in red! This is very confusing. Is the check-config script not reporting the correct things? Is my system still not setup properly? Does the docker command show the warning only once, by any chance?
How can I be sure that this has been setup properly before deploying my server to production?

Resources