Hello guys i try to install Parse-Server on my home server ( unraid ) with docker container from hub docker https://hub.docker.com/r/parseplatform/parse-server
Do somebody know how to inject package.json to install npm modules
I tried to move file to cloud/package.json and i get error: Cannot find module
and i have correct path to cloudCode folder because cloudColde runs.
Please help
here are my parameters
source: parseplatform/parse-server
name: parse-server
Post Argumente: --appId xxx --masterKey xxxx --databaseURI mongodb://192.168.178.27:27017/test --cloud /parse-server/cloud/main.js --mountGraphQL
-v config : /mnt/user/appdata/parse-server/config/
-v cloud: /mnt/user/appdata/parse-server/cloud/
-p: 1337
#Folder structure
cloud/
-main.js
-package.json
config/
-configuration.json
Guys i have a solution 💪 if you want to inject node modules to your docker container
you have to define in your local cloud folder package,json with your modules you want to.
you have to run “npm install” to install your dependencies.
3 run your docker container with -v mypath/config/:/parse-server/cloud --cloud /parse-server/cloud/main.js
Ready.
Many thanks to developers from Parse Server it is sooooo great system. I LOVE IT ❤️
Related
I have been using docker-compose, but noticed there is also a docker compose (without the dash).
I have not been able to quickly determine the differences between the two forms by googling.
Anyone?
docker compose's help:
docker-compose's help:
The docker compose (with a space) is a newer project to migrate compose to Go with the rest of the docker project. This is the v2 branch of the docker/compose repo. It's been first introduced to Docker Desktop users, so docker users on Linux didn't see the command. In addition to migrating to Go, it uses the compose-spec, and part of the rewrite may result in behavior differences.
The original python project, called docker-compose, aka v1 of docker/compose repo, has now been deprecated and development has moved over to v2. To install the v2 docker compose as a CLI plugin on Linux, supported distribution can now install the docker-compose-plugin package. E.g. on debian, I run apt-get install docker-compose-plugin.
Brandon Mitchell from docker's Captain Program replied to the github issue I opened on this as follows:
The docker/compose-cli project is in an in-between state, where it's not available in upstream releases of the docker-cli Linux packages, but is being included in Docker Desktop. The documentation pages normally follow what's in the docker/cli, so having this released to Desktop early puts the documentation in a difficult position. I'm going to raise this issue with the Docker team to see how they'd like to handle it.
Update: from docker github issue:
gtardif commented 2 days ago
compose command reference doc is now live
new docker-compose command reference
Quote from https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command
Compose V2 and the new docker compose command
Important
The new Compose V2,
which supports the compose command as part of the Docker CLI, is now available.
Compose V2 integrates compose functions into the Docker platform,
continuing to support most of the previous docker-compose features and flags.
You can run Compose V2 by replacing the hyphen (-) with a space,
using docker compose, instead of docker-compose.
In addition to what has been already said here, I have noticed an important difference between the two.
In our setup, the docker-compose.yml file is located in a template folder. This way we can run multiple instances of the same project based on the same template. The local instance has its own folder with its own .env file (and also its own volumes).
There is also a template .env file in the template folder : copied and adapted to the instance folder using a script.
In order to work, the docker-compose.yml file looks like this, in the template folder :
version: "3"
services:
wordpress:
image: wordpress
container_name: "${COMPOSE_PROJECT_NAME}_wordpress"
env_file:
- ${PWD}/.env
...
And the local instance .env file :
# compose file location
COMPOSE_FILE=../templateFolder/docker-compose.yml
# this instance name
COMPOSE_PROJECT_NAME=foo
In this context :
with docker-compose, the .env file is read in the instance location, which is expected
with docker compose, the .env file is read in the template location !
To override this, we had to rename the template .env file into dotEnv.
This behavior is very lightly described here : https://docs.docker.com/compose/#multiple-isolated-environments-on-a-single-host
If it not yet included in the docker installation, docker compose can be installed on Linux as CLI plugin.
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.tag_name')
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
See https://docs.docker.com/compose/cli-command/#installing-compose-v2
If you do not want to have changes, but desire the original legacy docker-compose functionality, also known as Compose standalone vs. Compose plugin, you can do the following:
# Run as root
VERSION=v2.12.2
curl -SL https://github.com/docker/compose/releases/download/$VERSION/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
# Test it
docker-compose
This allows you to e.g. keep using docker-compose in shell scripts.
Check versions on this page.
I'm following a tutorial for docker and docker compose. Although there is a npm install command in Dockerfile (as following), there is a situation that tutor have to run that command manually.
COPY package*.json .
RUN npm install
Because he is mapping the project current directory to the container by volumes as following:(which is like project runs in the container by mapped source code to the host directory)
api:
build: ./backend
ports:
- 3001:3000
environment:
DB_URL: mongodb://db/vidly
volumes:
- ./backend:/app
So npm install command in docker file doesn't make any sense. So he runs this command directly in the root of project.
So, another developer has to run npm install as well, (or if I add a new package, I should do it too) which seems not very developer friendly. Because the purpose of docker is not to do the instructions by yourself. So docker-compose up should do everything. Any idea about this problem would be appreciated.
I agree with #zeitounator, who adds very sensible commentary to your situation and use.
However, if you did want to solve the original problem of running a container that volume mounts in code, and have it run a development server, then you could move the npm command from the COPY directive to the CMD, or even add an entry script to the container that includes the npm call.
That way you could run the container with the volume mount, and the starting process (npm install, npm serve dev, etc) would occur at runtime as opposed to buildtime.
The best solution is as you mention yourself, Vahid, to use a smart Dockerfile that leverages sensible build caching, that allows the application to be built and ran with one command (and no external input). Perhaps you and your tutor can talk about these differences and come to an agreement
I have been using docker-compose, but noticed there is also a docker compose (without the dash).
I have not been able to quickly determine the differences between the two forms by googling.
Anyone?
docker compose's help:
docker-compose's help:
The docker compose (with a space) is a newer project to migrate compose to Go with the rest of the docker project. This is the v2 branch of the docker/compose repo. It's been first introduced to Docker Desktop users, so docker users on Linux didn't see the command. In addition to migrating to Go, it uses the compose-spec, and part of the rewrite may result in behavior differences.
The original python project, called docker-compose, aka v1 of docker/compose repo, has now been deprecated and development has moved over to v2. To install the v2 docker compose as a CLI plugin on Linux, supported distribution can now install the docker-compose-plugin package. E.g. on debian, I run apt-get install docker-compose-plugin.
Brandon Mitchell from docker's Captain Program replied to the github issue I opened on this as follows:
The docker/compose-cli project is in an in-between state, where it's not available in upstream releases of the docker-cli Linux packages, but is being included in Docker Desktop. The documentation pages normally follow what's in the docker/cli, so having this released to Desktop early puts the documentation in a difficult position. I'm going to raise this issue with the Docker team to see how they'd like to handle it.
Update: from docker github issue:
gtardif commented 2 days ago
compose command reference doc is now live
new docker-compose command reference
Quote from https://docs.docker.com/compose/#compose-v2-and-the-new-docker-compose-command
Compose V2 and the new docker compose command
Important
The new Compose V2,
which supports the compose command as part of the Docker CLI, is now available.
Compose V2 integrates compose functions into the Docker platform,
continuing to support most of the previous docker-compose features and flags.
You can run Compose V2 by replacing the hyphen (-) with a space,
using docker compose, instead of docker-compose.
In addition to what has been already said here, I have noticed an important difference between the two.
In our setup, the docker-compose.yml file is located in a template folder. This way we can run multiple instances of the same project based on the same template. The local instance has its own folder with its own .env file (and also its own volumes).
There is also a template .env file in the template folder : copied and adapted to the instance folder using a script.
In order to work, the docker-compose.yml file looks like this, in the template folder :
version: "3"
services:
wordpress:
image: wordpress
container_name: "${COMPOSE_PROJECT_NAME}_wordpress"
env_file:
- ${PWD}/.env
...
And the local instance .env file :
# compose file location
COMPOSE_FILE=../templateFolder/docker-compose.yml
# this instance name
COMPOSE_PROJECT_NAME=foo
In this context :
with docker-compose, the .env file is read in the instance location, which is expected
with docker compose, the .env file is read in the template location !
To override this, we had to rename the template .env file into dotEnv.
This behavior is very lightly described here : https://docs.docker.com/compose/#multiple-isolated-environments-on-a-single-host
If it not yet included in the docker installation, docker compose can be installed on Linux as CLI plugin.
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.tag_name')
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
See https://docs.docker.com/compose/cli-command/#installing-compose-v2
If you do not want to have changes, but desire the original legacy docker-compose functionality, also known as Compose standalone vs. Compose plugin, you can do the following:
# Run as root
VERSION=v2.12.2
curl -SL https://github.com/docker/compose/releases/download/$VERSION/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
# Test it
docker-compose
This allows you to e.g. keep using docker-compose in shell scripts.
Check versions on this page.
I have a Docker image and a cli tool. I want to create a Snap package that pulls the Docker image and run it on the local Docker.
I already have a snapcraft.yaml that installs the cli tool. I'm trying to understand what should I add/edit so I can call Docker actions.
Additionally, I'm trying to understand if in such case the Docker must be installed via Snap or as long as Docker is somehow installed on the machine everything is fine? What happens when there is no Docker installed?
From what I'v found on Snap Docs, I need to add to my snapcraft.yaml the docker interface so it will provide access to the Docker deamon socket, but I can't find any resources how to call Docker commands...
This is my snapcraft.yaml:
version: '1.0.0'
summary: |
Test CLI and Service
description: |
Some Test Description.
grade: devel
confinement: strict
plugs:
docker-cli:
interface: docker
docker-executables:
interface: content
target: $SNAP/docker-exes
default-provider: docker:docker-executables
parts:
jre:
source-type: tar
source: ./jre-source/zulu11.33.10-sa-jre11.0.4-linux_x64.tar.gz
plugin: dump
test-snap:
source-type: local
source: ./test-snap-source
plugin: dump
apps:
test-snap:
command: docker ps
plugs:
- docker
- docker-executables
- docker-cli
When I run the test-snap I'm getting
"/snap/test-snap/x6/command-test-snap.wrapper: 4: exec: docker: not found"
Thanks!
Found the following dockerized-app-snap repository on GitHub which really helped me to create a Snap that run a dockerzied app through the content-interface shared by the docker snap.
Attached my snapcraft.yaml for anyone who trying to do something similar:
name: my-app
version: '1.0.0'
summary: |
my-app Summary
description: |
Some my-app Description.
grade: devel
confinement: strict
plugs:
docker-cli:
interface: docker
docker-executables:
content: docker-executables
default-provider: docker
interface: content
target: docker-env
parts:
environment:
plugin: dump
source: ./src/
organize:
'docker-wrapper' : bin/
apps:
my-app:
command: docker-wrapper docker <any docker command ps/pull/run>
plugs: [docker-executables, docker-cli]
You can find general explanation on Snap Interfaces(plugs and slots) here
In short, an interface consists of a connection between a slot and a plug. The slot is the provider of the interface while the plug is the consumer.
In my case, the docker snap has 2 interfaces that it provides(slots) which my-app consumes(plugs) - the docker interface under the docker-cli plug and the content interface under docker-executables plug.
Regarding the question if Docker must be installed via Snap. Because my-app snap uses the docker snap interfaces, the answer it yes. But I'm not sure if it's conflict with a docker installed on the machine. will update when I have the answer.
Hoped I helped somebody!
I have a very simple dockerfile:
FROM scratch
MAINTAINER "aosmith" <a..h#...com>
EXPOSE 6379
ADD redis-server /redis-server
ENTRYPOINT ["/redis-server"]
The docker file is in a folder with a statically compiled copy of redis-server.
The build runs find but the container refuses to start:
➜ redis git:(master) ✗ docker run f16
no such file or directory
Error response from daemon: Cannot start container 46be4ed97560cd63fa4f639bed0e25358e807a8229bb3b5a613aa1274e037040: [8] System error: no such file or directory
I've tried various combinations of CMD EXEC ADD and COPY with no luck.
I'm building redis from source like this:
make CFLAGS="-static" EXEEXT="-static" \
MALLOC=libc LDFLAGS="-I/usr/local/include/"
Worth noting I use basically the exact same Dockerfile for go projects without any problems.
Any ideas?
The "scatch" image is literally empty and can only be used by technologies like go which have near zero dependencies on it's runtime environment.
Try a base image that supplies a set of OS utilities, like bash, etc. For example
FROM ubuntu
MAINTAINER "aosmith" <a..h#...com>
EXPOSE 6379
ADD redis-server /redis-server
ENTRYPOINT ["/redis-server"]