To pull centos as a base image to build other docker images:
docker pull centos:centosX
Where X can be 5, 6 or 7
To pull centos as a base image to build other docker images:
docker pull centos:centosX
Where X can be 5, 6 or 7
Command: docker run -p 5000:5000 registry
MongoDB aggregation result exceeds maximum document size (16MB)
{
“errmsg” : “exception: aggregation result exceeds maximum document size (16MB)”,
“code” : 16389,
“ok” : 0
}
Cause:
Solution for 2.4: Limit the output using $skip and $limit to fit the 16MB limit
Solution for 2.6:
Java driver: Use option:
.newAggregationOptions().outputMode(
AggregationOptions.OutputMode.CURSOR).build()
PHP driver:
public MongoCommandCursor MongoCollection::aggregateCursor ( array
$command
[, array$options
] )
When stopping a docker with mongod daemon running using command:
docker stop <container_id>
the next time you start the mongod docker, it will complain about unclean shutdown detected:
“Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery
instructions.”
Cause: “docker stop” use SIGTERM to kill mongod daemon, while it is recommended to use SIGINT
Solution:
docker kill -s INT <container_id>
Error: When running phantomjs command:
error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
Cause: Missing libfontconfig.so.1
Solution:
Centos:
sudo yum install fontconfig
Ubuntu:
sudo apt-get install libfontconfig1
Error: When using a callback like after(:create) or before(:create), Ruby raises this error:
Both value and block given (FactoryGirl::AttributeDefinitionError)
Cause: These callback syntaxes are supported from factory_girl 3.3.0 or above.
Solution:
Change after(:create) to after_create and before(:create) to before_create
Or Upgrade factory_girl to version >=3.3.0
Error: When using mongo gem in RoR:
Notice: The native BSON extension was not loaded. For optimal performance, use of the BSON extension is recommended. To enable the extension make sure ENV[‘BSON_EXT_DISABLED’] is not set and run the following command: gem install bson_ext
Cause:
bson_ext and mongo gem are not in the same version.
Solution: Install bson_ext and mongo gems using the same version, example: 1.9.2:
gem install mongo -v=1.9.2
gem install bson_ext -v=1.9.2
When running mongodump against a mongos instance where the sharded cluster consists of replica sets, the read preference of the operation will prefer reads from secondary members of the set.
Error: docker run with Exited (1)
Cause: the CMD you run inside the docker exits with error
Solution: Check the error in docker log by these steps:
1. sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4c94eb133b4 dockername:latest “httpd” 55 seconds ago Exited (1) 54 seconds ago0.0.0.0:80->80/tcp webserver
2. sudo docker logs CONTAINER_ID
Error: When using shard collection and querying, if we explicitly want to omit a field but want to sort on that field, Mongo raises error code 13431 since mongos can’t sort without that missing field:
db.collection.find({},{_id:0}).sort({_id:1});
error: {
“$err” : “have to have sort key in projection and removing it”,
“code” : 13431
}
Solution: do not omit the field used in sort