Skip to content

Commit 0e71c22

Browse files
authored
Merge pull request #553 from haitaohuang/docker_rel_2.9.2
Docker updates
2 parents c7bb69a + 388d52c commit 0e71c22

10 files changed

+56
-34
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
linux/installer/docker
2+
linux/installer/docker/*
3+
docker
4+
docker/*
5+
docker/build/*
6+
*.md
7+
.git*
8+
*/*/.git*
9+

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,19 @@ Documentation
2929
- [Intel(R) SGX for Linux\* OS](https://01.org/intel-softwareguard-extensions) project home page on [01.org](https://01.org)
3030
- [Intel(R) SGX Programming Reference](https://software.intel.com/sites/default/files/managed/7c/f1/332831-sdm-vol-3d.pdf)
3131

32-
Quick Start
32+
Quick Start with Docker and Docker Compose
3333
-----------------------------------------
34-
### Use Docker and Docker Compose
34+
35+
- Build PSW and SDK from source. See this [README](docker/build/README.md) for details.
3536
```
3637
$ cd docker/build && ./build_compose_run.sh
3738
```
38-
See this [README](docker/build/README.md) for details.
3939

40+
- Use prebuilt PSW and SDK downloaded from 01.org. See this [README](linux/installer/docker/README.md) for details.
41+
```
42+
$ cd linux/installer/docker && ./build_compose_run.sh
43+
```
44+
4045
Build and Install the Intel(R) SGX Driver
4146
-----------------------------------------
4247
Follow the [README.md](https://github.com/intel/SGXDataCenterAttestationPrimitives/blob/master/driver/linux/README.md) in the [SGXDataCenterAttestationPrimitives](https://github.com/intel/SGXDataCenterAttestationPrimitives/) project to build and install the Intel(R) SGX driver.

docker/build/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Files in this directory demonstrate how to build and install the SGX SDK and PSW
66

77
### Prerequisites
88
1. Install [Docker and Compose](https://docs.docker.com/) and configure them properly following their respective installation guide.
9-
2. Install [SGX out-of-tree driver](https://github.com/intel/linux-sgx-driver). **Note**: See below to run with the DCAP driver or an SGX capable kernel.
9+
2. Install [SGX Flexible Launch Control driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/driver/linux). **Note**: See below to run with the Legacy Launch Control driver.
1010

1111
### Run with Docker Compose
1212
This will start AESM and an SGX sample on one terminal using docker-compose.
@@ -38,15 +38,18 @@ The Dockerfile specifies 3 image build targets:
3838

3939
- [build_and_run_sample_docker.sh](./build_and_run_sample_docker.sh): Shows how to build and run the SampleEnclave app inside a Docker container with a locally built SGX sample image.
4040

41-
## DCAP driver and kernel with SGX patches
41+
## Legacy Launch Control driver and kernel for SGX
4242

4343
All SGX applications need access to the SGX device nodes exposed by the kernel space driver. Depending on the driver or kernel you are using, the SGX device nodes may have different names and locations. Therefore, you need to ensure those nodes are mapped and mounted inside the containers properly.
4444

45+
4546
[SGX kernel patches](https://github.com/jsakkine-intel/linux-sgx/commits/master) are still in process of upstreaming.
46-
The [DCAP driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/tree/master/driver) is developed to imitate the kernel patches as closely as possible. To use a custom built kernel with SGX patches or the DCAP driver instead of the SGX2 driver mentioned above, you need to make following modifications:
47-
1. Replace "/dev/isgx" device with "/dev/sgx/enclave" and "/dev/sgx/provision" devices for AESM in docker-compose.yml and build_and_run_aesm_docker.sh
48-
2. Replace "/dev/isgx" with "/dev/sgx/enclave" for the sample container in docker-compose.yml and build_and_run_sample_docker.sh
47+
The [Flexible Launch Control driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/tree/master/driver) is developed to imitate the kernel patches as closely as possible.
48+
49+
The sample scripts and Compose files are compatible with the Flexible Launch Control driver or a custom built kernel with SGX support. If you need to use the Legacy Launch Control driver then you need to make following modifications:
50+
1. Replace "/dev/sgx/enclave" device with "/dev/isgx" and **remove** "/dev/sgx/provision" device for AESM in docker-compose.yml and build_and_run_aesm_docker.sh
51+
2. Replace "/dev/sgx/enclave" with "/dev/isgx" for the sample container in docker-compose.yml and build_and_run_sample_docker.sh
4952

50-
**Note**: When you switch between DCAP and SGX2 drivers, make sure you uninstall the previous driver and reset the OS before installing the other one.
53+
**Note**: When you switch between drivers, make sure you uninstall the previous driver and reset the OS before installing the other one.
5154

52-
**Note**: Earlier versions of the DCAP driver and kernel patches may expose the SGX device as a single node at "/dev/sgx".
55+
**Note**: Earlier versions of the Flexible Launch Control driver and kernel patches may expose the SGX device as a single node at "/dev/sgx".

docker/build/build_and_run_aesm_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ docker build --target aesm --build-arg https_proxy=$https_proxy \
4141
mkdir -p -m 777 /tmp/aesmd
4242
chmod -R -f 777 /tmp/aesmd || sudo chmod -R -f 777 /tmp/aesmd || true
4343

44-
# If you use the DCAP driver, replace /dev/isgx with /dev/sgx/enclave, and add
44+
# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx, and remove
4545
# --device=/dev/sgx/provision
4646

47-
docker run --env http_proxy --env https_proxy --device=/dev/isgx -v /dev/log:/dev/log -v /tmp/aesmd:/var/run/aesmd -it sgx_aesm
47+
docker run --env http_proxy --env https_proxy --device=/dev/sgx --device=/dev/sgx/provision -v /dev/log:/dev/log -v /tmp/aesmd:/var/run/aesmd -it sgx_aesm

docker/build/build_and_run_sample_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ docker build --target sample --build-arg https_proxy=$https_proxy \
3434
--build-arg http_proxy=$http_proxy -t sgx_sample -f ./Dockerfile ../../
3535

3636
# Another container should expose AESM and its socket
37-
# Replace /dev/isgx with /dev/sgx/enclave if you use the DCAP driver
38-
docker run --env http_proxy --env https_proxy --device=/dev/isgx -v /tmp/aesmd:/var/run/aesmd -it sgx_sample
37+
# Replace /dev/sgx/enclave with /dev/isgx if you use the Legacy Launch Control driver
38+
docker run --env http_proxy --env https_proxy --device=/dev/sgx/enclave -v /tmp/aesmd:/var/run/aesmd -it sgx_sample

docker/build/docker-compose.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
#
30-
# If you use the DCAP driver, replace /dev/isgx with /dev/sgx/enclave for both
31-
# sample and aesm, and add /dev/sgx/provision in "devices" list for aesm
30+
# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx for both
31+
# sample and aesm, and remove /dev/sgx/provision in "devices" list for aesm
3232
#
3333
version: '3'
3434

3535
services:
3636
aesm:
3737
image: sgx_aesm
3838
devices:
39-
- /dev/isgx
39+
- /dev/sgx/enclave
40+
- /dev/sgx/provision
4041
volumes:
4142
- /tmp/aesmd:/var/run/aesmd
4243
stdin_open: true
@@ -50,7 +51,7 @@ services:
5051
depends_on:
5152
- aesm
5253
devices:
53-
- /dev/isgx
54+
- /dev/sgx/enclave
5455
volumes:
5556
- /tmp/aesmd:/var/run/aesmd
5657
stdin_open: true

linux/installer/docker/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Files in this directory demonstrate how to build and deploy SGX enclave applicat
66

77
### Prerequisites
88
1. Install [Docker and Compose](https://docs.docker.com/) and configure them properly following respective their installation guide.
9-
2. Install [SGX out-of-tree driver](https://github.com/intel/linux-sgx-driver). **Note**: See below to run with the DCAP driver or an SGX capable kernel.
9+
2. Install [SGX Flexible Launch Control driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/driver/linux). **Note**: See below to run with the Legacy Launch Control driver.
1010

1111
### Run with Docker Compose
1212
This will start AESM and an SGX sample on one terminal using docker-compose.
@@ -34,16 +34,19 @@ The [Dockerfile](../docker/Dockerfile) specifies 3 image build targets:
3434
2. aesm: Installs sgx-aesm and its dependencies from the SGX PPA and starts the AESM service.
3535
3. sample: Installs the SGX SDK and runtime libaries, builds and runs the SampleEnclave app in SDK sample code.
3636

37-
## DCAP driver and kernel with SGX patches
37+
## Legacy Launch Control driver and kernel for SGX
38+
39+
All SGX applications need access to the SGX device nodes exposed by the kernel space driver. Depending on the driver or kernel you are using, the SGX device nodes may have different names and locations. Therefore, you need to ensure those nodes are mapped and mounted inside the containers properly.
3840

39-
All SGX applications need access to the SGX device nodes exposed by kernel space driver. Depending on the driver or kernel you are using, the SGX device nodes may have different names and locations. Therefore, you need ensure those nodes mapped and mounted inside the containers appropriately.
4041

4142
[SGX kernel patches](https://github.com/jsakkine-intel/linux-sgx/commits/master) are still in process of upstreaming.
42-
The [DCAP driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/tree/master/driver) is developed to imitate the kernel patches as closely as possible. To use custom built kernel with SGX patches or the DCAP driver instead of the SGX2 driver mentioned above, you need make following modifications:
43-
1. Replace "/dev/isgx" device with "/dev/sgx/enclave" and "/dev/sgx/provision" devices for AESM in docker-compose.yml and build_and_run_aesm_docker.sh
44-
2. Replace "/dev/isgx" with "/dev/sgx/enclave" for the sample container in docker-compose.yml and build_and_run_sample_docker.sh
43+
The [Flexible Launch Control driver](https://github.com/intel/SGXDataCenterAttestationPrimitives/tree/master/driver) is developed to imitate the kernel patches as closely as possible.
44+
45+
The sample scripts and Compose files are compatible with the Flexible Launch Control driver or a custom built kernel with SGX support. If you need to use the Legacy Launch Control driver then you need to make following modifications:
46+
1. Replace "/dev/sgx/enclave" device with "/dev/isgx" and **remove** "/dev/sgx/provision" device for AESM in docker-compose.yml and build_and_run_aesm_docker.sh
47+
2. Replace "/dev/sgx/enclave" with "/dev/isgx" for the sample container in docker-compose.yml and build_and_run_sample_docker.sh
4548

46-
**Note**: When you switch between the DCAP and SGX2 drivers, make sure you uninstall the previous driver and reset the OS before installing the other one.
49+
**Note**: When you switch between drivers, make sure you uninstall the previous driver and reset the OS before installing the other one.
4750

48-
**Note**: Earlier versions of the DCAP driver and kernel patches may expose the SGX device as a single node at "/dev/sgx".
51+
**Note**: Earlier versions of the Flexible Launch Control driver and kernel patches may expose the SGX device as a single node at "/dev/sgx".
4952

linux/installer/docker/build_and_run_aesm_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ docker build --target aesm --build-arg https_proxy=$https_proxy \
4141
mkdir -p -m 777 /tmp/aesmd
4242
chmod -R -f 777 /tmp/aesmd || sudo chmod -R -f 777 /tmp/aesmd || true
4343

44-
# If you use the DCAP driver, replace /dev/isgx with /dev/sgx/enclave, and add
44+
# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx, and remove
4545
# --device=/dev/sgx/provision
46-
docker run --env http_proxy --env https_proxy --device=/dev/isgx -v /dev/log:/dev/log -v /tmp/aesmd:/var/run/aesmd -it sgx_aesm
46+
docker run --env http_proxy --env https_proxy --device=/dev/sgx/enclave --device=/dev/sgx/provision -v /dev/log:/dev/log -v /tmp/aesmd:/var/run/aesmd -it sgx_aesm

linux/installer/docker/build_and_run_sample_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ docker build --target sample --build-arg https_proxy=$https_proxy \
3434
--build-arg http_proxy=$http_proxy -t sgx_sample -f ./Dockerfile ./
3535

3636
# Another container should expose AESM and its socket
37-
# Replace /dev/isgx with /dev/sgx/enclave if you use the DCAP driver
38-
docker run --env http_proxy --env https_proxy --device=/dev/isgx -v /tmp/aesmd:/var/run/aesmd -it sgx_sample
37+
# Replace /dev/sgx/enclave with /dev/isgx if you use the Legacy Launch Control driver
38+
docker run --env http_proxy --env https_proxy --device=/dev/sgx/enclave -v /tmp/aesmd:/var/run/aesmd -it sgx_sample

linux/installer/docker/docker-compose.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
#
30-
# If you use the DCAP driver, replace /dev/isgx with /dev/sgx/enclave for both
31-
# sample and aesm, and add /dev/sgx/provision in "devices" list for aesm
30+
# If you use the Legacy Launch Control driver, replace /dev/sgx/enclave with /dev/isgx for both
31+
# sample and aesm, and remove /dev/sgx/provision in "devices" list for aesm
3232
#
3333
version: '3'
3434

3535
services:
3636
aesm:
3737
image: sgx_aesm
3838
devices:
39-
- /dev/isgx
39+
- /dev/sgx/enclave
40+
- /dev/sgx/provision
4041
volumes:
4142
- /tmp/aesmd:/var/run/aesmd
4243
stdin_open: true
@@ -50,7 +51,7 @@ services:
5051
depends_on:
5152
- aesm
5253
devices:
53-
- /dev/isgx
54+
- /dev/sgx/enclave
5455
volumes:
5556
- /tmp/aesmd:/var/run/aesmd
5657
stdin_open: true

0 commit comments

Comments
 (0)