1# Setting Up Ubuntu Development Environment in Docker Mode<a name="EN-US_TOPIC_0000001119805112"></a> 2 3- [Obtaining Standard-System Source Code](#section8761819202511) 4 - [Prerequisites](#section102871547153314) 5 - [Procedure](#section429012478331) 6 7- [Obtaining the Docker Environment](#section181431248132513) 8- [Building Source Code](#section92391739152318) 9 10The standard OpenHarmony system provides a Docker environment which encapsulates build tools. 11 12> **NOTE:** 13>- Before using Docker, install it by following instructions in [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/). 14>- You can also use the [installation package](quickstart-standard-package-environment.md) to set up the Ubuntu development environment. 15 16## Obtaining Standard-System Source Code<a name="section8761819202511"></a> 17 18### Prerequisites<a name="section102871547153314"></a> 19 201. Register your account with Gitee. 212. Register an SSH public key for access to Gitee. 223. Install the [git client](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information. 23 24 ``` 25 git config --global user.name "yourname" 26 git config --global user.email "your-email-address" 27 git config --global credential.helper store 28 ``` 29 304. Run the following commands to install the **repo** tool: 31 32 ``` 33 curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable. 34 chmod a+x /usr/local/bin/repo 35 pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests 36 ``` 37 38 39### Procedure<a name="section429012478331"></a> 40 41Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\) 42 43``` 44repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify 45repo sync -c 46repo forall -c 'git lfs pull' 47bash build/prebuilts_download.sh 48``` 49 50Method 2: Use the **repo** tool to download the source code over HTTPS. 51 52``` 53repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify 54repo sync -c 55repo forall -c 'git lfs pull' 56bash build/prebuilts_download.sh 57``` 58 59## Obtaining the Docker Environment<a name="section181431248132513"></a> 60 61**Method 1: Obtaining the Docker image from HUAWEI CLOUD SWR** 62 631. Obtain the Docker image. 64 65 ``` 66 docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 67 ``` 68 692. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment: 70 71 ``` 72 docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.4 73 ``` 74 75 76**Method 2: Using the Dockerfile to build a local docker image** 77 781. Obtain the Dockerfile script for a local Docker image. 79 80 ``` 81 git clone https://gitee.com/openharmony/docs.git 82 ``` 83 842. Go to the directory of the Dockerfile code and run the following command to build the Docker image: 85 86 ``` 87 cd docs/docker/standard 88 ./build.sh 89 ``` 90 913. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment: 92 93 ``` 94 docker run -it -v $(pwd):/home/openharmony openharmony-docker-standard:0.0.4 95 ``` 96 97 98## Building Source Code<a name="section92391739152318"></a> 99 1001. Run the following script to start building for Standard-System Devices \(reference memory ≥ 128 MB\): 101 102 ``` 103 ./build.sh --product-name {product_name} 104 ``` 105 106 **product\_name** indicates the product supported by the current distribution, for example, **Hi3516DV300**. 107 108 Files generated during the build are stored in the **out/ohos-arm-release/** directory, and the generated image is stored in the **out/ohos-arm-release/packages/phone/images/** directory. 109 1103. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md). 111 112> **NOTE:** 113>You can exit Docker by simply running the **exit** command. 114 115