Comments (16)
It'd be helpful if you can share the exact commands and output.
Also, are you saying it used to work and now it doesn't after the update?
from meteor-launchpad.
Yes exactly, @jshimko after this root fixes it stopped working. (I'm using partially forked of your implementation and doing a local build because of #19 )
This's the full command:
docker run -d -p 3000:3000 -v /home/sercan/mongoclient_data/:/data/db mongoclient/mongoclient
Since you're assigning /data/db
directory to mongodb user at inside of container, I guess it causes this issue. And I've found this that I thought it can be related, but couldn't actually be sure since I'm not an expert on docker.
from meteor-launchpad.
Hmm. According to that second link, you should be able to chown
the volume at runtime from inside the container. So presumably you could add it in the entrypoint script that starts Mongo.
So, right above this line...
https://github.com/jshimko/meteor-launchpad/blob/master/scripts/entrypoint.sh#L9
Add this...
chown -R mongodb:mongodb /data/{db,configdb}
(then obviously rebuild the image with ./build.sh
)
Let me know if that fixes it and I'll get it added in.
from meteor-launchpad.
Sorry but no chance:
[-] External MONGO_URL not found. Starting local MongoDB...
[-] External MONGO_URL not found. Starting local MongoDB...
chown: changing ownership of '/data/db': Operation not permitted
chown: changing ownership of '/data/configdb': Operation not permitted
By the way here's the branch that I'm trying to fix this issue, and here's the docker file it would be appreciated if you have a chance to look at these to ensure problem is not about my structure,
p.s. this changed my directory's users:
drwxrwxr-x 2 syslog crontab 4,0K Mar 17 15:14 mongoclient_data2
from meteor-launchpad.
Well, that seems strange. The official mongo image does exactly that in the same spot.
And I know you can expose the volume with the official image, so I'm not sure what's different. Do you already have existing data there? (outside of the container). That may be why. If so, try using an empty host directory and see if that lets you do it.
from meteor-launchpad.
Yeah, I thought the same way end cleared directory but didn't work either, sorry for causing more trouble.
Actually I've re-created directory:
sercan@aytws08:~$ pwd
/home/sercan
sercan@aytws08:~$ rm -rf mongoclient_data2/
sercan@aytws08:~$ mkdir mongoclient_data2/
sercan@aytws08:~$ docker run -d -p 5000:3000 -v /home/sercan/mongoclient_data2/:/data/db mongoclient-local
1efdac2f6d9693259932332cfe0eec70659c44c195c4df6661b1f2db198fee3f
sercan@aytws08:~$ docker logs 1efdac2f6d9693259932332cfe0eec70659c44c195c4df6661b1f2db198fee3f
[-] External MONGO_URL not found. Starting local MongoDB...
[-] External MONGO_URL not found. Starting local MongoDB...
chown: changing ownership of '/data/db': Operation not permitted
chown: changing ownership of '/data/configdb': Operation not permitted
from meteor-launchpad.
For what it's worth, you could just use the official Mongo image with Docker Compose. That obviously doesn't fix this image, but it's generally a better practice to use separate containers anyway. That way you can update them individually.
# docker-compose.yml
app:
image: yourname/app
ports:
- "80:3000"
links:
- mongo
environment:
- ROOT_URL=http://example.com
- MONGO_URL=mongodb://mongo:27017/meteor
mongo:
image: mongo:latest --storageEngine=wiredTiger
volumes:
- /path/on/host:/data/db
Then...
docker-compose up -d
from meteor-launchpad.
That also allows you to keep all of your config in a file and run a really simple command to start everything (instead of a long docker run
command).
from meteor-launchpad.
I'll try this asap, thanks, I assume I need to disable installing mongodb inside of container ?
from meteor-launchpad.
By the way, I'm using an automated build on docker hub, will this be sufficient for all docker people ?
from meteor-launchpad.
I don't see why not. Assuming it finishes successfully, a build there should be the same as a build from anywhere else.
from meteor-launchpad.
I guess I solved it (without compose), changing owner of data path to node recursively and during installation of mongodb, doing same thing resolved it, now I'm able to use another volume.
#install-mongo.sh
chown -R node:node /data/{db,configdb}
#entrypoint.sh
chown -R node:node /data/{db,configdb}
if hash mongod 2>/dev/null; then
printf "\n[-] External MONGO_URL not found. Starting local MongoDB...\n\n"
chown -R node:node /data
exec gosu node mongod --storageEngine=wiredTiger > /dev/null 2>&1 &
else
from meteor-launchpad.
But I'm still unable to run my image with user --user node
and still it's running as root :(
from meteor-launchpad.
Ah. You didn't mention that you were trying to run with the --user
flag. That shouldn't be necessary. The app is already run by the node
user. And using that flag is going to be a problem when you're running two processes in the same container with two different users (which is one of the many reasons you're supposed to do one process per container with Docker).
I don't think I can remove the Mongo option at this point, but I do think you should always use an external Mongo container in production. It's a best practice for good reasons. I originally only included Mongo as an optional install in this image because some people like having a quick/easy way to run mongo in development without having to deal with multiple containers. It's really not a great idea to run everything in one place in production though.
from meteor-launchpad.
Just so you know, that's the entire point of gosu. You can run the container as root and gosu steps down the app processes to whatever non-root user you want. So you have all of the flexibility of running as root, but the security of running the app processes as non-root.
from meteor-launchpad.
Thank you so much for your great support, actually I totally agree with you to keep everything separated for production use, but since mongoclient is a product, and more probably people don't want to be bothered for such an extra step while installing it.
I now changed it a bit and did mongodb installation via using curl for the tarball. You can check here. With this altitude I'm now able to use USER node
in main Dockerfile
I was actually trying to do an openshift deployment but I failed anyway, and gave up. But at least now have a proper docker setup :)
Thanks again.
from meteor-launchpad.
Related Issues (20)
- Update to debian stable HOT 13
- Oracle jdbc driver HOT 2
- yarn: command not found HOT 4
- Adding settings.json to .dockerignore? HOT 2
- can't find entrypoint.sh HOT 2
- Hot code push to browser
- Failed to build container due to removal of Wheezy and Jessie from mirrors HOT 1
- Build failed - 404 HOT 1
- Meteor installation fails on Windows
- New Debian Release HOT 1
- 'p80.pool.sks-keyservers.net: Host not found' HOT 4
- Should Gosu vesrion be configurable
- Docker build fails when installing gosu
- E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file. HOT 3
- Redirect to https localhost
- E: Unable to locate package libarchive-tools HOT 4
- Meteor requires Node v14.0.0 or later. HOT 2
- docker build fails - HOT 4
- Package 'python' has no installation candidate HOT 1
- E: Package 'python' has no installation candidate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-launchpad.