composer cannot allocate memory inside container docker - symfony

I currently use docker to run my Symfony3. But I get this error when I try to run composer update inside my container (after doing command docker exec -it <name of the bash container>)
[ErrorException]
Proc_open (): fork failed - Can not allocate memory
The composer documentation asks to configure the swap of the machine but I get this error by following the steps of the documentation
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 (OK)
/sbin/mkswap /var/swap.1 (OK)
/sbin/swapon /var/swap.1 (KO) -->
Swapon: /var/swap.1: swapon failed: Operation not permitted
(Even though I'm in root mode)

I finally found the answer to my problem.
You can start by adding space on your virtual machine (default). In my case I switched from 1GB to 2GB.
Then you can, if you wish, launch your container with the option --memory-swap = -1 or a space you have chosen
https://docs.docker.com/engine/admin/resource_constraints/#memory-swap-details
It's OK for me now ;) .

Related

macOS DDEV drush command Permission denied (Experimental docker settings)

When I updated ddev version 1.19.0 then drush command doesn't work.
$ ddev drush
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/mnt/ddev_config/.global_commands/web/drush": permission denied: unknown
Failed to run drush : exit status 126
So, I have to use command ddev exec drush instead of ddev drush
Who does have any idea?
You don't say much about your environment, but I imagine you're on macOS and you installed Docker Desktop 4.6.0+ and you enabled the experimental virtualization and VirtioFS features. Please uncheck them, they're not ready for prime time. For performance, I recommend enabling mutagen, people love it, https://ddev.readthedocs.io/en/latest/users/performance/#using-mutagen

How to install Apache Superset in Ubuntu 18.04

I am following the steps laid out here:
https://superset.apache.org/docs/installation/installing-superset-using-docker-compose
I run running one by one:
We recommend that you check out and run the code from the last tagged
release
$ git checkout latest
Then, run the following command:
$ docker-compose up
And I am getting this error:
WARNING: The CYPRESS_CONFIG variable is not set. Defaulting to a blank
string.
ERROR: Couldn't connect to Docker daemon - you might need to run docker-machine start default.
I am not able to find how to install and start default server with docker-machine.
Try to use this command before docker-compose up:
export DOCKER_HOST=unix:///var/run/docker.sock
It will export DOCKER_HOST to environment variables and help docker client to find a connection to Docker daemon.

Docker: Permission denied when running rocker/shiny-verse and rocker/shiny images

I'm trying to run Shiny Server on an EC2 instance running Ubuntu.
Following this page, I run this command: docker run --rm -p 3838:3838 rocker/shiny.
I get the following warning and error:
s6-supervise shiny-server: warning: unable to spawn ./run - waiting 10 seconds
s6-supervise (child): fatal: unable to exec run: Exec format error
After that, those two outputs just repeat every 10 seconds. I can't even kill the process, so I have to close the terminal and start another one.
I'm new to Docker and have no real clue how to proceed from here. Any help would be appreciated.
Updates:
At least I've tracked down what s6-supervise is: part of a set of utilities revolving around process supervision and management, logging, and system initialization.

Error when trying to run a meteor app in docker using meteorhacks:meteord

I have just began playing around with docker. While trying out method 1 from meteorhacks:meteord, I get the folowing error
=> You don't have an meteor app to run in this image.
Here is what I have done after creating the basic counter demo meteor app.
docker build -t app .
Sending build context to Docker daemon 11.75 MB
Step 0 : FROM meteorhacks/meteord:base
---> 528baf8d4263
Step 1 : MAINTAINER MeteorHacks Pvt Ltd.
---> Running in 6d7e7eb6ebce
---> d69fefdbeb70
Removing intermediate container 6d7e7eb6ebce
Step 2 : ONBUILD copy ./ /app
---> Running in e68618104dfa
---> c253ae966ea1
Removing intermediate container e68618104dfa
Step 3 : ONBUILD run bash $METEORD_DIR/on_build.sh
---> Running in e51e557c2b05
---> a6a6a1be9147
Removing intermediate container e51e557c2b05
Successfully built a6a6a1be9147
then ( I already initiated a mongo container exposing 27017 and grabbed the internal ip address which was 171.17.0.1)
docker run -d \
-e ROOT_URL=http://localhost:3000 \
-e MONGO_URL=mongodb://172.17.0.1:27017/ \
-e MONGO_OPLOG_URL=mongodb://172.17.0.1:27017/ \
-p 8080:80 \
app
I get the error when I do this and then run docker logs <container id>
Can someone guide me on this?
Thanks in advance.
This error comes from scripts/run_app.sh, which is the ENTRYPOINT of the base Dockerfile.
It checks for the presence of:
/bundle folder, or
/built_app, or
$BUNDLE_URL
If your counter demo Dockerfile didn't populate /bundle or /built_app folders, then you need to make sure you are defining ENV BUNDLE_URL with the right url.

Memory issue with meteor up (mup) on Digital Ocean

I couldn't find existing posts related to my issue. On a Digital Ocean Droplet, mup setup went fine, but when I try to deploy, I get the following error. Any ideas? Thanks!
root#ts:~/ts-deploy# mup deploy
Meteor Up: Production Quality Meteor Deployments
Building Started: /root/TS/
Bundling Error: code=137, error:
-------------------STDOUT-------------------
Figuring out the best package versions to use. This may take a moment.
-------------------STDERR-------------------
bash: line 1: 31217 Killed meteor build --directory /tmp/dc37af3e-eca0-4a19-bf1a-d6d38bb8f517
Below are the logs. node -v indicates I am using 0.10.31. How do I check which script is exiting with the error? Any other ideas? Thanks!
error: Forever detected script exited with code: 1
error: Script restart attempt #106
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #107
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #108
stepping down to gid: meteoruser
stepping down to uid: meteoruser
After I went back to an old backup of the DO Droplet, and re-ran mup setup and mup deploy, I now get this in the command line output
Building Started: /root/TS
Bundling Error: code=134, error:
-------------------STDOUT-------------------
Figuring out the best package versions to use. This may take a moment.
-------------------STDERR-------------------
FATAL ERROR: JS Allocation failed - process out of memory
bash: line 1: 1724 Aborted (core dumped) meteor build --directory /tmp/bfdbcb45-9c61-435f-9875-3fb304358996
and this in the logs:
>> stepping down to gid: meteoruser
>> stepping down to uid: meteoruser
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
at Package (packages/accounts-oauth/oauth_server.js:45)
at packages/accounts-base/accounts_server.js:383
at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
at packages/ddp/livedata_server.js:648
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
at Package (packages/accounts-oauth/oauth_server.js:45)
at packages/accounts-base/accounts_server.js:383
at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
at packages/ddp/livedata_server.js:648
The memory issue stems from using DigitalOcean's $5 Droplet. To solve the problem, I added swap to the server, as explained in detail below.
Create and enable the swap file using the dd command :
sudo dd if=/dev/zero of=/swapfile bs=1024 count=256k
“of=/swapfile” designates the file’s name. In this case the name is swapfile.
Next prepare the swap file by creating a linux swap area:
sudo mkswap /swapfile
The results display:
Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb
Finish up by activating the swap file:
sudo swapon /swapfile
You will then be able to see the new swap file when you view the swap summary.
swapon -s
Filename Type Size Used Priority
/swapfile file 262140 0 -1
This file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.
Open up the file:
sudo nano /etc/fstab
Paste in the following line:
/swapfile none swap sw 0 0
Swappiness in the file should be set to 10. Skipping this step may cause both poor performance, whereas setting it to 10 will cause swap to act as an emergency buffer, preventing out-of-memory crashes.
You can do this with the following commands:
echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
To prevent the file from being world-readable, you should set up the correct permissions on the swap file:
sudo chown root:root /swapfile
sudo chmod 0600 /swapfile
This only worked for me by increasing the swap space to 1gb:
Make all swap off
sudo swapoff -a
Resize the swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
Make swapfile usable
sudo mkswap /swapfile
Make swapon again
sudo swapon /swapfile

Resources