Docker: Using Docker
Jump to navigation
Jump to search
This guide assumes docker is installed and the service is running;
Version etc
# For system-wide information on docker:
sudo docker info
# For docker version:
sudo docker versionSearch for Docker images
docker search centosPulling down a Docker Image
[root@blade02 ~]# docker pull centos
latest: Pulling from centos
47d44cb6f252: Pull complete
838c1c5c4f83: Pull complete
5764f0a31317: Pull complete
60e65a8e4030: Pull complete
centos:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:8072bc7c66c3d5b633c3fddfc2bf12d5b4c2623f7004d9eed6aae70e0e99fbd7
Status: Downloaded newer image for centos:latest
# OR
docker pull ubuntuShow Images locally installed
[root@blade02 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest 60e65a8e4030 7 weeks ago 196.6 MBRun a Docker Container
docker run -i -t centos /bin/bashCheck Docker Processes Running (on Server)
[root@blade02 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
540a25cda4af centos "/bin/bash" 11 seconds ago Up 9 seconds compassionate_pike
8f88fb204119 ubuntu "/bin/bash" 8 minutes ago Up 8 minutes sick_lalande
# and to show non-running containers
docker ps -lStop and Remove a Container
# get the container ID;
[root@blade02 ~]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
540a25cda4af centos "/bin/bash" About a minute ago Up About a minute compassionate_pike
[root@blade02 ~]# docker stop 540a25cda4af
540a25cda4af
[root@blade02 ~]# docker rm 540a25cda4af
540a25cda4af