Showing posts with label container. Show all posts
Showing posts with label container. Show all posts

Sunday, 6 October 2024

Installing kali linux image with podman

Installing kali linux image with podman

1.      Install podman using yum

#yum install podman



To check version of the installed podman you can use “-v” or “--version”

# podman -v

(or)

#podman --version



To check if any container running use below command

# podman ps -a


We can also check same with podman container ls and to show already downloaded images podman image ls.

# podman container ls

#podman image ls


 To search if a particular image is available in the configured repositories.

# podman search kali-rolling


To download image from the repository.

# podman pull kali-rolling


To see if the image is downloaded.

# podman image ls


 To run the container

# podman run –tty –interactive kali-rolling

This command will connect to the tty terminal of the kali linux container. From this bash you can execute all kali linux commands.


 


To exit from the terminal you can give exit at the bash prompt.

Once exited container also will be stopped. To start the container we can use below command.

# podman start container_name


To login to the container you can use podman attach command as below,

# podman attach container_name




Wednesday, 30 June 2021

Docker image push

To push a image to docker hub follow below,

Use docker container ls command to list running container image details.

 [root@jkcli ~]# docker container ls
CONTAINER ID   IMAGE     COMMAND              CREATED          STATUS          PORTS                                   NAMES
cb72f5d90279   httpd     "httpd-foreground"   21 minutes ago   Up 21 minutes   0.0.0.0:8080->80/tcp, :::8080->80/tcp   jkapache
[root@jkcli ~]#

Use docker container commit command to commit container as a image with tag.

[root@jkcli ~]# docker container commit cb72f5d90279 jk-httpd:test
sha256:8daf5db17d6fdb0fd6ceea7e4d6ed38d22c3fdad6375f479ed6fc7986eec4a61
[root@jkcli ~]#

You can now list and see the created image is available.

[root@jkcli ~]# docker image ls
REPOSITORY   TAG       IMAGE ID       CREATED              SIZE
jk-httpd     test      8daf5db17d6f   About a minute ago   189MB
httpd        latest    30287d899656   7 days ago           138MB
nginx        latest    d1a364dc548d   5 weeks ago          133MB
[root@jkcli ~]#


To upload your newly created image to docker hub. First you have to login to docker with docker login credentials. To do this use, docker login command.

[root@jkcli ~]# docker login

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.

Username: karthick04

Password: XXXXX

Now we can tag the image across the repository created in the docker hub. Here I have already created a repository karthick04/jkrepo. 

Command : docker tag source_image:tag target_image:tag

[root@jkcli ~]# docker tag jk-httpd:test karthick04/jkrepo:version1
REPOSITORY          TAG        IMAGE ID       CREATED         SIZE
karthick04/jkrepo   version1   8daf5db17d6f   9 minutes ago   189MB
jk-httpd            test       8daf5db17d6f   9 minutes ago   189MB
httpd               latest     30287d899656   7 days ago      138MB
nginx               latest     d1a364dc548d   5 weeks ago     133MB
[root@jkcli ~]# 
[root@jkcli ~]# docker image ls

To push the image finally to the docker hub use docker image push command. 

[root@jkcli ~]# docker image push karthick04/jkrepo:version1
The push refers to repository [docker.io/karthick04/jkrepo]
c54811c7708d: Pushed
dfd488a286c9: Pushed
15176fdb9a61: Pushed
61172cb5065c: Pushed
9fbbeddcc4e4: Pushed
764055ebc9a7: Pushed
version1: digest: sha256:c6271d65a6b6a4b6274adcbd51b0ddd5dab1b94b8112ccdbd7d407770bdb238b size: 1578
[root@jkcli ~]#


Successfully we have pushed the image to docker hub, we can see this image in docker hub now

https://hub.docker.com/r/karthick04/jkrepo

Also you can pull same image using docker pull karthick04/jkrepo:version1


[root@jkcli ~]# docker pull karthick04/jkrepo:version1
version1: Pulling from karthick04/jkrepo
b4d181a07f80: Already exists
4b72f5187e6e: Already exists
12b2c44d04b2: Already exists
ef481fc2a03a: Already exists
d483d945fcab: Already exists
6b6a1b4ae105: Pull complete
Digest: sha256:c6271d65a6b6a4b6274adcbd51b0ddd5dab1b94b8112ccdbd7d407770bdb238b
Status: Downloaded newer image for karthick04/jkrepo:version1
docker.io/karthick04/jkrepo:version1
[root@jkcli ~]# docker image ls
REPOSITORY          TAG        IMAGE ID       CREATED          SIZE
karthick04/jkrepo   version1   8daf5db17d6f   26 minutes ago   189MB
httpd               latest     30287d899656   7 days ago       138MB
nginx               latest     d1a364dc548d   5 weeks ago      133MB
[root@jkcli ~]#


Friday, 18 June 2021

Docker installation issues



Docker Installation issues
 
This document is intended to cover Docker Engine installation issue. 


Scenario 1: Installing Docker CE on CentOS 8.4 Server GUI
Installing Docker CE on Centos 8.4 should be pretty simple using the script https://get.docker.com/
However you should consider some pre-requisites to perform a smooth installation of Docker CE 

Version Involved:
Linux : CentOS Linux release 8.4.2105
Docker : Docker version 20.10.7, build f0df350

CentOS 8.4 Server GUI version is found to have default containerd packages which would conflict Docker CE installation. Before proceeding with Installation we must remove these conflicts.
 
Packages to be removed : runc, container-selinux

#yum remove runc
#yum remove container-selinux


Now we can install Docker CE successfully using Docker installation script

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh