Grab the dockerfile from either of these locations:
https://github.com/scollier/Fedora-Dockerfiles
or:
https://git.fedorahosted.org/cgit/dockerfiles.git/
Get the version of Docker
# docker version
To build:
Copy the sources down -
# docker build -rm -t
To run:
# docker run -d -p 27017
Watch for the database to initialize and start listening (using the container ID from "docker run":
# docker logs 3a2aaa5b803f597732b18
Tue Dec 17 20:34:42.655 [initandlisten] command local.$cmd command: { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 reslen:37 360ms
Tue Dec 17 20:34:42.661 [websvr] admin web console waiting for connections on port 28017
Tue Dec 17 20:34:42.725 [initandlisten] waiting for connections on port 27017
Get the port that the container is listening on:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c8fc42d19fd3
To test, Find the IP Address of the container.
# docker inspect c8fc42d19fd3 | grep -i ipaddr
"IPAddress": "172.17.0.28",
# mongo --host 172.17.0.28 --port 49158
MongoDB shell version: 2.4.6
connecting to: 127.0.0.1:49158/test
>
This is what it looks like.
No comments:
Post a Comment