I have this Dockerfile for my API project using Node.js — Express.js
api.dockerfile
FROM node:9.3.0
COPY package.json ./
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i && npm install nodemon --save \
&& npm install pm2 -g \
&& npm install -g sequelize-cli \
&& mkdir /ng-app \
&& chown -R node:node /ng-app \
&& cp -R ./node_modules ./ng-app
# Migration
RUN sequelize db:migrate
RUN sequelize db:seed:all
USER node
WORKDIR /ng-app
COPY . .
RUN mv docker.env .env
CMD ["pm2-runtime", "index.js"]
docker-compose.yaml
version: "2"
services:
iproject-api:
build:
context: ./api
dockerfile: api.dockerfile
image: 'iproject-api'
ports:
- '3002:3002'
iproject-web:
build:
context: ./web
dockerfile: web.dockerfile
image: 'iproject-web:latest'
ports:
- '8080:8080'
links:
- iproject-api
This is the result, I got
**docker-compose build --no-cache**
Building iproject-api
Step 1/11 : FROM node:9.3.0
---> 3d1823068e39
Step 2/11 : COPY package.json ./
---> 68d259bbd036
Removing intermediate container 792b207a42ed
Step 3/11 : RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
---> Running in ebd53a0f0e3d
npm WARN using --force I sure hope you know what you are doing.
---> cd598f62f4e5
Removing intermediate container ebd53a0f0e3d
Step 4/11 : RUN npm i && npm install nodemon --save && npm install pm2 -g && npm install -g sequelize-cli && mkdir /ng-app && chown -R node:node /ng-app && cp -R ./node_modules ./ng-app
---> Running in 492ea3c40c22
> bcrypt@1.0.3 install /node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@9.3.0 (node-v59 ABI) (falling back to source compile with node-gyp)
make: Entering directory '/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
In file included from ../../nan/nan.h:192:0,
from ../src/bcrypt_node.cc:1:
../../nan/nan_maybe_43_inl.h: In function 'Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)':
../../nan/nan_maybe_43_inl.h:112:73: warning: 'v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)' is deprecated (declared at /root/.node-gyp/9.3.0/include/node/v8.h:3114): Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
^
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
COPY /node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/node_modules/bcrypt/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
added 259 packages in 9.9s
> nodemon@1.14.10 postinstall /node_modules/nodemon
> node -e "console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n')" || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ nodemon@1.14.10
added 246 packages in 7.093s
/usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2
/usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev
/usr/local/bin/pm2-runtime -> /usr/local/lib/node_modules/pm2/bin/pm2-runtime
/usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ pm2@2.9.1
added 251 packages in 6.35s
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/lib/sequelize
+ sequelize-cli@3.2.0
added 105 packages in 3.718s
---> 19c196ba636a
Removing intermediate container 492ea3c40c22
Step 5/11 : RUN sequelize db:migrate
---> Running in cc84d0fbfc57
Sequelize CLI [Node: 9.3.0, CLI: 3.2.0, ORM: 4.31.0]
WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support
ERROR: Cannot find «/config/config.json». Have you run «sequelize init»?
How would one go about debugging this?
Hello everyone,
been trying to launch the bot via docker but even though there is a config.json under user-data I get the following error:
2020-11-04 07:51:16,151 - freqtrade.worker - INFO - Starting worker 2020.10
2020-11-04 07:51:16,151 - freqtrade.configuration.configuration - INFO - Using config: config.json ...
2020-11-04 07:51:16,151 - freqtrade.commands.trade_commands - ERROR - Config file "config.json" not found! Please create a config file or check whether it exists.
2020-11-04 07:51:16,151 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
Traceback (most recent call last):
File "/freqtrade/freqtrade/configuration/load_config.py", line 49, in load_config_file
with open(path) if path != '-' else sys.stdin as file:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/freqtrade/freqtrade/commands/trade_commands.py", line 18, in start_trading
worker = Worker(args)
File "/freqtrade/freqtrade/worker.py", line 35, in __init__
self._init(False)
File "/freqtrade/freqtrade/worker.py", line 49, in _init
self._config = Configuration(self._args, None).get_config()
File "/freqtrade/freqtrade/configuration/configuration.py", line 41, in get_config
self.config = self.load_config()
File "/freqtrade/freqtrade/configuration/configuration.py", line 94, in load_config
config: Dict[str, Any] = self.load_from_files(self.args.get("config", []))
File "/freqtrade/freqtrade/configuration/configuration.py", line 73, in load_from_files
config = deep_merge_dicts(load_config_file(path), config)
File "/freqtrade/freqtrade/configuration/load_config.py", line 52, in load_config_file
raise OperationalException(
freqtrade.exceptions.OperationalException: Config file "config.json" not found! Please create a config file or check whether it exists.
how come is there a step a missed?
JSON проблемы с config.json чаще всего связаны с повреждением или отсутствием файла Windows. Большую часть проблем, связанных с данными файлами, можно решить посредством скачивания и установки последней версии файла JSON. Кроме того, регулярная очистка и оптимизация реестра Windows предотвратит создание неправильных ссылок на пути к файлам JSON, поэтому мы настоятельно рекомендуем регулярно выполнять сканирование реестра.
Config.json для %%os%% и почти для всех версий операционной системы Windows можно скачать ниже. В настоящее время в нашей безе отсутствуют некоторые файлы config.json, однако вы можете получить их по запросу, нажав на кнопку Request (Запрос) рядом с соответствующей версией файла. В крайнем случае, если ниже отсутствует необходимый вам файл ниже, для получения необходимой версии вы также можете связаться с Microsoft.
Если вы успешно заменили соответствующий файл в соответствующем месте, у вас больше не должно возникать проблем, связанных с config.json. Однако мы рекомендуем выполнить быструю проверку, чтобы окончательно в этом убедиться. Проверьте результат замены файла, запустив Windows и проверив выводится ли возникающая ранее ошибка.
config.json Описание файла | |
---|---|
Формат файла: | JSON |
Софт: | Windows |
Версия программного обеспечения: | 8.1 |
Разработчик программного обеспечения: | Microsoft |
Имя: | config.json (Загрузить) |
Байт: | 974 |
Базовый файл ОС: | Windows 8.1 |
Продукт Solvusoft
Загрузка
WinThruster 2023 — Сканировать ваш компьютер на наличие ошибок реестра в config.json
Windows
11/10/8/7/Vista/XP
Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление
JSON
config.json
Идентификатор статьи: 56692
Config.json
Имя файла | Контрольная сумма MD5 | Байт | Загрузить | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ config.json | a25fdfca477e4e59c304118d6e6214ea | 974.00 B | ||||||||||||||||||
|
||||||||||||||||||||
+ config.json | 81e7b893baaa68c05a2cd6ebdb900699 | 87.00 B | ||||||||||||||||||
|
||||||||||||||||||||
+ config.json | 81e7b893baaa68c05a2cd6ebdb900699 | 87.00 B | ||||||||||||||||||
|
Распространенные сообщения об ошибках в Config.json
Лучшие ошибки config.json с Windows в Windows:
- «Ошибка в файле Config.json.»
- «Отсутствует файл Config.json.»
- «config.json не найден.»
- «Не удалось загрузить модуль для config.json. «
- «Отсутствует модуль: не удалось зарегистрировать config.json»
- «Ошибка Config.json во время выполнения. «
- «Файл Config.json не может быть загружен. «
Проблемы с config.json возникают во время запуска или завершения работы, во время запуска программы, связанной с config.json, или иногда во время обновления или установки Windows. Важно не учитывать, когда возникают проблемы с config.json, так как это помогает устранять ошибки, связанные с Windowss, и сообщать о них в Microsoft.
Корень проблем Config.json
Проблемы config.json могут быть отнесены к поврежденным или отсутствующим файлам, содержащим ошибки записям реестра, связанным с config.json, или к вирусам / вредоносному ПО.
Особенно эти ошибки config.json проистекают из:
- Недопустимая (поврежденная) запись реестра config.json.
- Вирус или вредоносное ПО поврежден config.json.
- Другая программа злонамеренно или по ошибке удалила файлы, связанные с config.json.
- Другая программа, конфликтующая с config.json или другой общей ссылкой Windows.
- Неполный или поврежденный config.json из ошибочной загрузки или установки.
Docker uses a configuration file, config.json, for unencrypted storage of credentials. The docker error loading config file triggers due to a number of reasons including an empty config file.
As a part of our docker hosting support, we help our Customers to fix similar docker related errors regularly.
Let us today discuss the possible causes and fixes for this error.
What are the causes for docker error loading config file?
As we discussed earlier, the config.json file in docker stores the unencrypted credentials. Thus during docker installation, while we use docker CLI using sudo before adding the user to the docker group, we might encounter an error message, telling that ~/.docker/
directory was created with incorrect permissions:
WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied
Let us now look at the fixes for this error message.
How to fix docker error loading config file
Changing the ownership and permissions using the following commands can fix the permission issue with the configuration file.
$ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
$ sudo chmod g+rwx "/home/$USER/.docker" -R
Another common solution is to remove the ~/.docker/
directory. This removes the directory created with wrong permissions and will help to fix the issue. However, if we remove the directory, it re-generates automatically when we rerun Docker. Thus it removes any custom settings in the config file during the deletion of the configuration file.
Apart from the fixes above, adding an empty json object {} to the file can fix the error loading config file when the configuration file is empty
[Need any further assistance in fixing Docker errors? – We’re available 24*7]
Conclusion
In short, the error loading config file triggers due to reasons like an empty config file or permission issue with the configuration file. Today, we saw how our Support Engineers fix this error.
When working with Docker on Ubuntu, you may encounter a warning message: “WARNING: Error loading config file:/home/user/.docker/config.json – stat /home/user/.docker/config.json: permission denied”. This article will guide you through the steps to resolve this issue and explain why it occurs.
To fix the «config.json Permission Denied» error in Docker on Ubuntu, you can change the ownership and permissions of the .docker
directory and its contents using the chown
and chmod
commands in the terminal. Alternatively, you can change the ownership to a specific group, such as the docker
group.
- Understanding the Error
- Fixing the Permission Issue
- Changing Ownership
- Changing Permissions
- Alternative Solution
- Conclusion
Understanding the Error
This error message indicates that Docker is unable to access the config.json
file in the .docker
directory due to permission restrictions. In Linux and Unix systems, files and directories have ownership and permissions that control who can read, write, and execute them. In this case, the user running Docker does not have the necessary permissions to access the config.json
file.
Fixing the Permission Issue
To fix this issue, we need to change the ownership and permissions of the .docker
directory and its contents. This can be done using the chown
and chmod
commands in the terminal.
Changing Ownership
The chown
command is used to change the ownership of files and directories in Linux. The syntax is chown [OPTIONS] USER[:GROUP] FILE(s)
.
To change the ownership of the .docker
directory and its contents to the current user, run the following command:
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
This command uses the sudo
command to run the command with root privileges. The "$USER":"$USER"
part specifies the new owner and group for the files. The "$USER"
environment variable automatically gets replaced with the current username. The -R
option tells chown
to operate on files and directories recursively.
Changing Permissions
The chmod
command is used to change the permissions of files and directories in Linux. The syntax is chmod [OPTIONS] MODE FILE(s)
.
To grant read, write, and execute permissions to the owner and the group for the .docker
directory, run the following command:
sudo chmod g+rwx "/home/$USER/.docker" -R
The g+rwx
part specifies the new permissions. g
stands for group, +
means add the following permissions, and rwx
stands for read, write, and execute.
Alternative Solution
Alternatively, you can change the ownership to a specific group, such as the docker
group. This can be done by running:
sudo chown "$USER":docker /home/"$USER"/.docker -R
If you encounter the error specifically with the config.json
file, you can try changing its ownership using the command:
sudo chown "$USER":docker /home/"$USER"/.docker/config.json
Conclusion
The permission issue with the config.json
file should not affect the functionality of Docker itself. The warning message is simply indicating that the file could not be loaded due to insufficient permissions. As long as Docker is able to run and execute containers, you can ignore the warning. However, it’s recommended to fix the permissions to avoid any potential issues in the future.
Remember to use sudo
with caution, as it provides elevated privileges. Always double-check your commands before executing them. For more information on Docker and its usage, you can refer to the official Docker documentation here.
The config.json
file in Docker is used to store configuration settings for Docker, such as authentication credentials, registry configurations, and network settings.
The «permission denied» error occurs when Docker is unable to access the config.json
file due to insufficient permissions. This can happen if the user running Docker does not have the necessary ownership and permissions for the file.
To fix this error, you can change the ownership and permissions of the .docker
directory and its contents using the chown
and chmod
commands in the terminal. The steps for fixing the permission issue are outlined in the article above.
Yes, you can ignore the warning message as long as Docker is able to run and execute containers without any issues. The warning is simply indicating that the config.json
file could not be loaded due to insufficient permissions. However, it is recommended to fix the permissions to avoid potential issues in the future.
Yes, an alternative solution is to change the ownership of the .docker
directory to a specific group, such as the docker
group. This can be done using the chown
command with the appropriate group name. The command is provided in the article above.