part 1 docker getting started

add your user to docker group
# usermod -a -G docker user1

to use docker commands as user1 without logging out of system, run below command as user1

~$ newgrp docker

docker provides many ways to run commands in containers
container are about running process
focusing on "docker run"

docker run ubuntu:latest  ls -lh /etc/postfix

# get inside docker

docker run -i -t ubuntu:latest
type exit to exit



## remove docker container after running the command called "sleep 100"
docker run --rm busybox:1.24  sleep 100


## remove docker container after running the command called "sleep 100"
docker run --rm busybox:1.24  sleep 100

## specify name for docker container we want to run
docker run  --name  mycontainer100 busybox:1.24
docker run  --name  mycontainer200 busybox:latest
docker ps -a

docker inspect containerid
##outpus image id , logpath,mac id

user1@localhost$ docker run -d busybox:latest sleep 10
a7393fc5cc8e1db7e87b9eb24151147

user1@localhost$ docker inspect a7393fc5cc8e1db7e87b9eb24151147


No comments:

Post a Comment