docker commands
~/dockerfile/Dockerfile
FROM centos
VOLUME /Users/sundar.rajagopalan/Downloads
VOLUME /Users/sundar.rajagopalan/docker-dir
RUN ["useradd", "builder"]
RUN ["yum", "install", "rpm-build", "-y"]
RUN ["yum", "install", "redhat-rpm-config", "-y"]
RUN ["yum", "install", "wget", "-y"]
RUN ["install", "-d", "-o", "builder", "-m", "755", "/home/builder/rpmbuild"]
WORKDIR "/home/builder/rpmbuild"
RUN ["install", "-d", "-o", "builder", "-m", "755", "BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]
ENTRYPOINT ["/bin/bash"]
docker build -t rpmtest .
This creates an image called “rpmtest”
Verify that the image exists by doing a:
docker images
Launch an instance with:
docker run -i -t -v /Users/sundar.rajagopalan/Downloads:/downloads /Users/sundar.rajagopalan/build:/build --name firstone rpmtest
Start a stopped instance with:
docker start -a -i <container_id>
Connecting to an existing container
docker attach <container_id or container_name>
Removing an image
docker rmi <image_name>
docker rm $(docker ps -q -f status=exited)