-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
--- | ||
title: Building images | ||
pagination_label: Building Docker images | ||
description: How to build docker images. | ||
title:Buildingimages | ||
pagination_label:BuildingDockerimages | ||
description:Howtobuilddockerimages. | ||
--- | ||
|
||
# Building images | ||
#Buildingimages | ||
|
||
Follow the [official guide](https://docs.docker.com/build/) for more in-depth information. | ||
Followthe[officialguide](https://docs.docker.com/build/)formorein-depthinformation. | ||
|
||
### Building a Docker Image from a Dockerfile | ||
###BuildingaDockerImagefromaDockerfile | ||
|
||
A Dockerfile is a text file containing a series of instructions to create a Docker image. | ||
Here's how to build an image using a Dockerfile. | ||
ADockerfileisatextfilecontainingaseriesofinstructionstocreateaDockerimage. | ||
Here'showtobuildanimageusingaDockerfile. | ||
|
||
1. **Create a Dockerfile**: | ||
Write a `Dockerfile` with the necessary instructions for your application. Example: | ||
```dockerfile | ||
# Use the MRS UAV System the base image | ||
FROM ctumrs/mrs_uav_system:latest | ||
# Install additional packages into the image | ||
RUN sudo apt-get -y install <my_dependency> | ||
1.**CreateaDockerfile**: | ||
Writea`Dockerfile`withthenecessaryinstructionsforyourapplication.Example: | ||
```dockerfile | ||
#UsetheMRSUAVSystemthebaseimage | ||
FROMctumrs/mrs_uav_system:latest | ||
|
||
#Installadditionalpackagesintotheimage | ||
RUNsudoapt-get-yinstall<my_dependency> | ||
|
||
# Specify the default command to run | ||
CMD ["/ros_entrypoint.sh"] | ||
``` | ||
2. **Save the Dockerfile:** Save the Dockerfile in the root directory of your project. | ||
3. **Build the Docker Image:** Use the docker build command to build the image. Run this command in the same directory as your Dockerfile: | ||
#Specifythedefaultcommandtorun | ||
CMD["/ros_entrypoint.sh"] | ||
``` | ||
2.**SavetheDockerfile:**SavetheDockerfileintherootdirectoryofyourproject. | ||
3.**BuildtheDockerImage:**Usethedockerbuildcommandtobuildtheimage.RunthiscommandinthesamedirectoryasyourDockerfile: | ||
```bash | ||
docker build -t <image-name>:<tag> . | ||
dockerbuild-t<image-name>:<tag>. | ||
``` | ||
Example: | ||
```bash | ||
docker build -t my-app:latest . | ||
dockerbuild-tmy-app:latest. | ||
``` | ||
|
||
* The `-t` flag assigns a name and tag to your image (e.g., my-app:latest). | ||
* The `.` at the end specifies the build context (the current directory). | ||
*The`-t`flagassignsanameandtagtoyourimage(e.g.,my-app:latest). | ||
*The`.`attheendspecifiesthebuildcontext(thecurrentdirectory). | ||
|
||
## Dockerfile for the MRS UAV System | ||
##DockerfilefortheMRSUAVSystem | ||
|
||
```dockerfile | ||
FROM ctumrs/ros:noetic | ||
FROMctumrs/ros:noetic | ||
|
||
RUN apt-get -y update | ||
RUNapt-get-yupdate | ||
|
||
# workaround interractive prompts during apt installations | ||
RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install keyboard-configuration | ||
#workaroundinterractivepromptsduringaptinstallations | ||
RUNecho'debconfdebconf/frontendselectNoninteractive'|sudodebconf-set-selections | ||
RUNDEBIAN_FRONTEND=noninteractiveapt-get-yinstallkeyboard-configuration | ||
|
||
# INSTALL the MRS UAV System | ||
#INSTALLtheMRSUAVSystem | ||
|
||
RUN apt-get -y install software-properties-common curl bash | ||
RUNapt-get-yinstallsoftware-properties-commoncurlbash | ||
|
||
RUN curl https://ctu-mrs.github.io/ppa-stable/add_ppa.sh | bash | ||
RUNcurlhttps://ctu-mrs.github.io/ppa-stable/add_ppa.sh|bash | ||
|
||
RUN apt-get -y install ros-noetic-mrs-uav-system-full | ||
RUNapt-get-yinstallros-noetic-mrs-uav-system-full | ||
|
||
CMD ["/ros_entrypoint.sh"] | ||
CMD["/ros_entrypoint.sh"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters