Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

strapi-docker is not working on CentOS 8 #169

Closed
zzkevinlim opened this issue Jan 7, 2020 · 12 comments
Closed

strapi-docker is not working on CentOS 8 #169

zzkevinlim opened this issue Jan 7, 2020 · 12 comments

Comments

@zzkevinlim
Copy link

zzkevinlim commented Jan 7, 2020

Fresh installation:

docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi

Error:

Status: Downloaded newer image for strapi/strapi:latest
Using strapi 3.0.0-beta.18.3
No project found at /srv/app. Creating a new strapi project
Creating a new Strapi application at /srv/app.

Creating a project from the database CLI arguments.
Creating files.
Error while installing dependencies:
error An unexpected error occurred: "https://registry.yarnpkg.com/strapi: getaddrinfo EAI_AGAIN registry.yarnpkg.com".

 Keep trying!             

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentionned in the installation errors and try to run the following command:

cd /srv/app && yarn install

So I did what it says, went into the project folder and ran yarn install.

Run again:

docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi

Error:

Starting your app...
Building your admin UI with development configuration ...

✔ Webpack
  Compiled successfully in 36.01s

[2020-01-07T09:53:44.142Z] error The client `sqlite3` is not installed.
[2020-01-07T09:53:44.143Z] error You can install it with `$ npm install sqlite3 --save`.

So I did what it says, went into the project folder and ran yarn add sqlite3 --save.

Run again:

docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi

Error:

Starting your app...
[2020-01-07T09:54:14.759Z] error The client `sqlite3` is not installed.
[2020-01-07T09:54:14.760Z] error You can install it with `$ npm install sqlite3 --save`.

EDIT: This was done on a freshly created droplet.

@alexandrebodin
Copy link
Member

When you are running strapi in a docker container you shouldn't install the dependencies on the host machine but from the docker container.

It seems the first command you ran should have worked and it was just a connection issue with yarn. Have you tried deleting the project-name folder and retry ?

@zzkevinlim
Copy link
Author

zzkevinlim commented Jan 7, 2020

Thanks for the quick response. How can I run yarn install from the container when the container does not even start to begin with?

[root@vultr www]# docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi
Unable to find image 'strapi/strapi:latest' locally
latest: Pulling from strapi/strapi
9a0b0ce99936: Pull complete 
db3b6004c61a: Pull complete 
f8f075920295: Pull complete 
6ef14aff1139: Pull complete 
0bbd8b48260f: Pull complete 
524be717efb1: Pull complete 
da330b3729a7: Pull complete 
2c9863d012f5: Pull complete 
06cd084e76f0: Pull complete 
dd204b5ce04a: Pull complete 
923ba817a26e: Pull complete 
330c35386cf5: Pull complete 
Digest: sha256:fefe0295916cd70349ca3d90e7bffdfaad00e50a4e500200332c0f3a58e6a99a
Status: Downloaded newer image for strapi/strapi:latest
Using strapi 3.0.0-beta.18.3
No project found at /srv/app. Creating a new strapi project
Creating a new Strapi application at /srv/app.

Creating a project from the database CLI arguments.
Creating files.
Error while installing dependencies:
error An unexpected error occurred: "https://registry.yarnpkg.com/strapi: getaddrinfo EAI_AGAIN registry.yarnpkg.com".

 Keep trying!             

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentionned in the installation errors and try to run the following command:

cd /srv/app && yarn install

[root@vultr www]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@vultr www]# 

It never worked, any help is appreciated.

@alexandrebodin
Copy link
Member

You can run docker run -it -p 1338:1338 -vpwd/project-name:/srv/app strapi/strapi bash
to run bash command inside your container and run commands from there.

I don't really see why you wouldn't be able to connect to the yarn registry 🤔

Let me know what happens when you run the yarn install command from your container plz

@zzkevinlim
Copy link
Author

zzkevinlim commented Jan 7, 2020

[root@vultr www]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@vultr www]# docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi bash
Starting your app...
root@c4ceb184fd04:/srv/app# yarn install
yarn install v1.19.1
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/strapi: getaddrinfo EAI_AGAIN registry.yarnpkg.com".
info If you think this is a bug, please open a bug report with the information provided in "/srv/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
root@c4ceb184fd04:/srv/app# yarn -v
1.19.1

@alexandrebodin
Copy link
Member

This seems to be coming for issue you migth have with your dns where you are connected to the internet :/

Some old issues reporting sth similar npm/npm#16661

@zzkevinlim
Copy link
Author

Thanks! Will return to this.

@zzkevinlim zzkevinlim reopened this Jan 7, 2020
@zzkevinlim
Copy link
Author

zzkevinlim commented Jan 7, 2020

Could this be a Docker issue? On the droplet, I'm able to run yarn install on the host machine though. I have tried the alternate method which is using docker-compose, same issue when it's trying to run yarn. This is on CentOS 8.

@alexandrebodin
Copy link
Member

It might be :/ You should go for a custom image base on the strapi/base image maybe.

@alexandrebodin
Copy link
Member

@zzkevinlim Have you tried on another system ?

I don't see how I can help you here. If you have found a solution please let us know.

WIll be closing this Issue in a few days of there is no more activity ;)

@alexandrebodin
Copy link
Member

I'm closing this issue as it doesn't seem to be related to the image itself

@Kyle772
Copy link

Kyle772 commented Jan 16, 2021

I know this is closed but I have a possible solution for this issue and found this link before any others on my google search, hopefully, this will point other devs in the right direction at the very least.

I ran into this on Ubuntu 18.04 x64 using a vultr server. I believe centOS 8 may have the same or a similar issue I was facing. Like @zzkevinlim I was getting this error:

[2020-01-07T09:54:14.759Z] error The client `sqlite3` is not installed.
[2020-01-07T09:54:14.760Z] error You can install it with `$ npm install sqlite3 --save`.

Thanks to the people in this thread I realized that this wasn't a sqlite3 error but an error with yarn itself (though not DNS related).
Since this is a docker container I didn't want to have to go in and manually install yarn whenever the container was built so I installed it on the host server before running docker-compose.

In my case (on Ubuntu 18.04 x64) yarn wasn't being installed at all, cmdtest was. This seems to be an ongoing issue with a few Linux builds as referenced here, here, and here all in the past year. I think this is very likely a common point of failure on the developer/install side (me included) but I managed to work around this despite nobody having a clear answer in any of the threads I looked up.

Add the key to apt

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Remove cmdtest if you downloaded it by mistake

apt remove cmdtest
apt autoremove

Add yarn to the apt source list and install yarn

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install yarn

Then rebuild the container and it should hopefully work.

There are very good odds I fixed my issue somewhere else along the way but I think this is what fixed it. If you're running into this along with the weird cmdtest note during the install of yarn it may be worth it to give this a shot.

@dhuacon
Copy link

dhuacon commented Aug 17, 2021

ATTENTION!

For people who use docker on wsl2 and it doesn't work for them. I have put the network that the container uses to be the
host(--network host):
docker run -it --network host -p 1337:1337 -v ${pwd}/strapi-poiapp:/srv/app strapi/strapi

At least it worked this way for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants