tencent cloud

All product documents
Tencent HealthCare Omics Platform
Create Docker Images
Last updated: 2024-10-22 16:05:05
Create Docker Images
Last updated: 2024-10-22 16:05:05

The Methods for Creating Container Images

There are two main methods for creating a container image:
1. Get the image through a snapshot.
2. Build the image using Dockerfile.
The first method is applicable when subsequent images do not change, and the second one is applicable when subsequent images change frequently.

Method 1: Obtain the image through a snapshot

1. Install the container engine software.
2. Start a blank basic container and enter it.
docker run -it centos
3. Perform the installation tasks:
yum install XXX
git clone https://github.com/lh3/bwa.git
cd bwa;make
4. Exit the container:
exit
5. Make a snapshot:
docker commit -m "xx" -a "test" container-id test/image:tag
6. View the created container image:
docker images

Method 2: Build the image using Dockerfile

Method 2 is applicable to situations where subsequent images are frequently changed. It automates the creation of images by executing the Dockerfile.
For example:
FROM ubuntu:latest

SHELL ["/bin/bash", "-c"]

RUN set -e \
&& apt-get -y update \
&& apt-get -y dist-upgrade \
&& apt-get -y install curl build-essential libncurses5-dev zlib1g-dev libbz2-dev liblzma-dev libcurl4-openssl-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# samtools

RUN set -eo pipefail \
&& curl -SL \
https://github.com/samtools/samtools/releases/download/1.15/samtools-1.15.tar.bz2 \
-o /tmp/samtools.tar.bz2 \
&& tar xvf /tmp/samtools.tar.bz2 -C /usr/local/src \
&& mv /usr/local/src/samtools-* /usr/local/src/samtools \
&& cd /usr/local/src/samtools \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
For more Dockerfile syntax, see Official Dockerfile Documentation.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon