1.

How do you work on a container image?

Answer»

--Get docker images from docker hub or your docker REPOSITORY

docker PULL busybox docker pull centos docker pull divyabhushan/myrepo Divya1@Divya:~ $docker pull divyabhushan/myrepo Using default tag: latest latest: Pulling from divyabhushan/myrepo 6cf436f81810: Pull complete 987088a85b96: Pull complete b4624b3efe06: Pull complete d42beb8ded59: Pull complete d08b19d33455: Pull complete 80d9a1d33f81: Pull complete Digest: sha256:c82b4b701af5301cc5d698d963eeed46739e67aff69fd1a5f4ef0aecc4bf7bbf STATUS: Downloaded newer image for divyabhushan/myrepo:latest

--List the docker images

Divya1@Divya:~ $docker images REPOSITORY            TAG IMAGE ID            CREATED SIZE divyabhushan/myrepo   latest 72a21c221add        About an hour ago 88.1MB busybox               latest 3a093384ac30        5 weeks ago 1.2MB centos                latest 1e1148e4cc2c        2 months ago 202MB

--Create a docker container by running the docker image

--pass a shell argument  : `uname -a`

Divya1@Divya:~ $docker run centos uname -a Linux c70fc2da749a 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

--Docker images can be built by reading a dockerfile

--build a new image : ‘newrepo’ with tag:1.0 from the dockerFiles/dockerfile

docker build -t newrepo:1.1 dockerFiles/

--Now create a container from the above image:

--List all the containers

--start the container

--List only the running containers



Discussion

No Comment Found