centos docker community version install:
yum -y install docker # install docker
systemctl start docker.service # start docker service
systemctl enable docker.service # enale docker service when power on
docker run hello-world # need to pull from docker repository the first time
docker container:
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -d -p 4000:80 friendlyname # detached mode,4000(image) 80(localhost)
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker container ls # List all running containers
docker container ls -a # List all containers, even those not running
docker container stop <hash> # Gracefully stop the specified container
docker container kill <hash> # Force shutdown of the specified container
docker container rm <hash> # Remove specified container from this machine
docker container rm $(docker container ls -a -q) # Remove all containers
docker image ls -a # List all images on this machine
docker image rm <image id> # Remove specified image from this machine
docker image rm $(docker image ls -a -q) # Remove all images from this machine
docker login # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag # Tag <image> for upload to registry
docker push username/repository:tag # Upload tagged image to registry
docker run username/repository:tag # Run image from a registry
docker services:
docker swarm init # first time you deploy an app or after you shutdown the swarm
docker stack ls # List stacks or apps
docker stack deploy -c <composefile> <appname> # Run the specified Compose file
docker service ls # List running services associated with an app
docker service ps <service> # List tasks associated with an app
docker inspect <task or container> # Inspect task or container
docker container ls -q # List container IDs
docker stack rm <appname> # Tear down an application
docker swarm leave --force # Take down a single node swarm from the manager
docker swarm:
docker pull docker.io/vickeywu/docker_test:test
or docker run -p 8080:8080 vickeywu/docker_test:test
curl localhost:8080
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install kernel-devel kernel-headers dkms
yum -y groupinstall "Development Tools"
yum -y update
wget http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
rpm --import oracle_vbox.asc
wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
yum -y install VirtualBox-5.1
systemctl start vboxdrv.service
usermod -a -G vboxusers root
references:
install:http://www.linuxidc.com/Linux/2014-12/110034.htm
container:https://docs.docker.com/get-started/
swarm:http://www.itzgeek.com/how-tos/linux/centos-how-tos/install-virtualbox-4-3-on-centos-7-rhel-7.html