Arm64 and check Compose v2 support (#177)

add support of arm64 architecture for the following samples: 
* aspnet-mssql
* elasticsearch-logstash-kibana
* nginx-aspnet-mysql
* nginx-flask-mysql
* nginx-golang-mysql
* react-java-mysql
* sparkjava-mysql
* wordpress-mysql
* react-express-mysql
* react-express-mongodb

Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
master
Guillaume Lours 3 years ago committed by GitHub
parent d48e8350ea
commit 4bba832f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,10 @@ services:
ports: ports:
- 80:80 - 80:80
db: db:
image: microsoft/mssql-server-linux # mssql server image isn't available for arm64 architecture, so we use azure-sql instead
image: mcr.microsoft.com/azure-sql-edge:1.0.4
# If you really want to use MS SQL Server, uncomment the following line
#image: mcr.microsoft.com/mssql/server
... ...
``` ```
The compose file defines an application with two services `web` and `db`. The image for the web service is built with the Dockerfile inside the `app` directory (build parameter). The compose file defines an application with two services `web` and `db`. The image for the web service is built with the Dockerfile inside the `app` directory (build parameter).
@ -28,6 +31,10 @@ The compose file defines an application with two services `web` and `db`. The im
When deploying the application, docker-compose maps the container port 80 to port 80 of the host as specified in the file. When deploying the application, docker-compose maps the container port 80 to port 80 of the host as specified in the file.
Make sure port 80 on the host is not being used by another container, otherwise the port should be changed. Make sure port 80 on the host is not being used by another container, otherwise the port should be changed.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use Azure SQL Edge as database instead of MS SQL Server.
> You still can use the MS SQL Server image by uncommenting the following line in the Compose file
> `#image: mcr.microsoft.com/mssql/server`
## Deploy with docker-compose ## Deploy with docker-compose

@ -7,7 +7,10 @@ services:
environment: environment:
ACCEPT_EULA: "Y" ACCEPT_EULA: "Y"
SA_PASSWORD: example_123 SA_PASSWORD: example_123
image: mcr.microsoft.com/mssql/server # mssql server image isn't available for arm64 architecture, so we use azure-sql instead
image: mcr.microsoft.com/azure-sql-edge:1.0.4
# If you really want to use MS SQL Server, uncomment the following line
#image: mcr.microsoft.com/mssql/server
restart: always restart: always
healthcheck: healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P example_123 -Q 'SELECT 1' || exit 1"] test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P example_123 -Q 'SELECT 1' || exit 1"]

@ -46,7 +46,7 @@ After the application starts, navigate to below links in your web browser:
* Elasticsearch: [`http://localhost:9200`](http://localhost:9200) * Elasticsearch: [`http://localhost:9200`](http://localhost:9200)
* Logstash: [`http://localhost:9600`](http://localhost:9600) * Logstash: [`http://localhost:9600`](http://localhost:9600)
* Kibana: [`http://localhost:5601`](http://localhost:5601) * Kibana: [`http://localhost:5601/api/status`](http://localhost:5601/api/status)
Stop and remove the containers Stop and remove the containers
``` ```

@ -1,6 +1,6 @@
services: services:
elasticsearch: elasticsearch:
image: elasticsearch:7.8.0 image: elasticsearch:7.14.2
container_name: es container_name: es
environment: environment:
discovery.type: single-node discovery.type: single-node
@ -16,7 +16,7 @@ services:
networks: networks:
- elastic - elastic
logstash: logstash:
image: logstash:7.8.0 image: logstash:7.14.2
container_name: log container_name: log
environment: environment:
discovery.seed_hosts: logstash discovery.seed_hosts: logstash
@ -35,7 +35,7 @@ services:
- elastic - elastic
command: logstash -f /usr/share/logstash/pipeline/logstash-nginx.config command: logstash -f /usr/share/logstash/pipeline/logstash-nginx.config
kibana: kibana:
image: kibana:7.8.0 image: kibana:7.14.2
container_name: kib container_name: kib
ports: ports:
- "5601:5601" - "5601:5601"

@ -24,7 +24,10 @@ services:
build: backend build: backend
... ...
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
proxy: proxy:
build: proxy build: proxy
@ -36,6 +39,11 @@ The compose file defines an application with three services `proxy`, `backend` a
When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file. When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file.
Make sure port 80 on the host is not already being in use. Make sure port 80 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -3,6 +3,6 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MySql.Data" Version="8.0.23" /> <PackageReference Include="MySqlConnector" Version="0.61.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,17 +1,21 @@
services: services:
backend: backend:
build: backend build: backend
restart: always
secrets: secrets:
- db-password - db-password
depends_on: depends_on:
- db - db
environment: environment:
- ASPNETCORE_URLS=http://+:8000 - ASPNETCORE_URLS=http://+:8000
depends_on: # depends_on:
db: # db:
condition: service_healthy # condition: service_healthy
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password' command: '--default-authentication-plugin=mysql_native_password'
restart: always restart: always
healthcheck: healthcheck:

@ -21,7 +21,10 @@ services:
build: backend build: backend
... ...
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
proxy: proxy:
build: proxy build: proxy
@ -31,6 +34,11 @@ The compose file defines an application with three services `proxy`, `backend` a
When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file. When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file.
Make sure port 80 on the host is not already being in use. Make sure port 80 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -1,6 +1,9 @@
services: services:
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password' command: '--default-authentication-plugin=mysql_native_password'
restart: always restart: always
healthcheck: healthcheck:

@ -24,7 +24,10 @@ services:
build: backend build: backend
... ...
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
proxy: proxy:
build: proxy build: proxy
@ -36,6 +39,11 @@ The compose file defines an application with three services `proxy`, `backend` a
When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file. When deploying the application, docker-compose maps port 80 of the proxy service container to port 80 of the host as specified in the file.
Make sure port 80 on the host is not already being in use. Make sure port 80 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -7,7 +7,10 @@ services:
db: db:
condition: service_healthy condition: service_healthy
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password' command: '--default-authentication-plugin=mysql_native_password'
restart: always restart: always
healthcheck: healthcheck:

@ -7,11 +7,7 @@ exports.connect = (app) => {
const options = { const options = {
useNewUrlParser: true, useNewUrlParser: true,
autoIndex: false, // Don't build indexes autoIndex: false, // Don't build indexes
reconnectTries: 30, // Retry up to 30 times maxPoolSize: 10, // Maintain up to 10 socket connections
reconnectInterval: 500, // Reconnect every 500ms
poolSize: 10, // Maintain up to 10 socket connections
// If not connected, return errors immediately rather than waiting for reconnect
bufferMaxEntries: 0,
}; };
const connectWithRetry = () => { const connectWithRetry = () => {
@ -24,7 +20,7 @@ exports.connect = (app) => {
app.emit("ready"); app.emit("ready");
}) })
.catch((err) => { .catch((err) => {
console.log("MongoDB connection unsuccessful, retry after 2 seconds."); console.log("MongoDB connection unsuccessful, retry after 2 seconds.", err);
setTimeout(connectWithRetry, 2000); setTimeout(connectWithRetry, 2000);
}); });
}; };

@ -1,5 +1,5 @@
# Create image based on the official Node image from dockerhub # Create image based on the official Node image from dockerhub
FROM node:lts-buster-slim FROM node:lts-buster
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@
"@testing-library/user-event": "^7.2.1", "@testing-library/user-event": "^7.2.1",
"axios": "^0.21.4", "axios": "^0.21.4",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"node-sass": "^6.0.1", "sass": "^1.43.4",
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-scripts": "^4.0.3" "react-scripts": "^4.0.3"

@ -27,7 +27,10 @@ services:
- 9230:9230 - 9230:9230
... ...
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
frontend: frontend:
build: frontend build: frontend
@ -39,6 +42,11 @@ The compose file defines an application with three services `frontend`, `backend
When deploying the application, docker-compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file. When deploying the application, docker-compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file.
Make sure port 3000 on the host is not already being in use. Make sure port 3000 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -28,7 +28,10 @@ services:
depends_on: depends_on:
- db - db
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password' command: '--default-authentication-plugin=mysql_native_password'
restart: always restart: always
secrets: secrets:

@ -23,7 +23,10 @@ services:
build: backend build: backend
... ...
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
frontend: frontend:
build: frontend build: frontend
@ -35,6 +38,11 @@ The compose file defines an application with three services `frontend`, `backend
When deploying the application, docker-compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file. When deploying the application, docker-compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file.
Make sure port 3000 on the host is not already being in use. Make sure port 3000 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -13,10 +13,13 @@ services:
db: db:
condition: service_healthy condition: service_healthy
db: db:
# We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.19
environment: environment:
MYSQL_DATABASE: example - MYSQL_DATABASE=example
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
image: mysql:8.0.19
restart: always restart: always
healthcheck: healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]

@ -22,13 +22,21 @@ services:
ports: ports:
- 8080:8080 - 8080:8080
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
``` ```
The compose file defines an application with two services `backend` and `db`. The compose file defines an application with two services `backend` and `db`.
When deploying the application, docker-compose maps port 8080 of the backend service container to port 80 of the host as specified in the file. When deploying the application, docker-compose maps port 8080 of the backend service container to port 80 of the host as specified in the file.
Make sure port 8080 on the host is not already being in use. Make sure port 8080 on the host is not already being in use.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```

@ -6,7 +6,10 @@ services:
secrets: secrets:
- db-password - db-password
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
restart: always restart: always
secrets: secrets:
- db-password - db-password

@ -1,5 +1,5 @@
## Wordpress with MySQL ## WordPress with MySQL
This example defines one of the basic setups for Wordpress. More details on how this works can be found on the official [wordpress image page](https://hub.docker.com/_/wordpress). This example defines one of the basic setups for WordPress. More details on how this works can be found on the official [WordPress image page](https://hub.docker.com/_/wordpress).
Project structure: Project structure:
@ -13,7 +13,10 @@ Project structure:
``` ```
services: services:
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
... ...
wordpress: wordpress:
image: wordpress:latest image: wordpress:latest
@ -23,9 +26,14 @@ services:
... ...
``` ```
When deploying this setup, docker-compose maps the wordpress container port 80 to When deploying this setup, docker-compose maps the WordPress container port 80 to
port 80 of the host as specified in the compose file. port 80 of the host as specified in the compose file.
> **_INFO_**
> For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL.
> You still can use the MySQL image by uncommenting the following line in the Compose file
> `#image: mysql:8.0.27`
## Deploy with docker-compose ## Deploy with docker-compose
``` ```
@ -48,7 +56,7 @@ CONTAINER ID IMAGE COMMAND CREATED
e0884a8d444d mysql:8.0.19 "docker-entrypoint.s…" 35 seconds ago Up 34 seconds 3306/tcp, 33060/tcp wordpress-mysql_db_1 e0884a8d444d mysql:8.0.19 "docker-entrypoint.s…" 35 seconds ago Up 34 seconds 3306/tcp, 33060/tcp wordpress-mysql_db_1
``` ```
Navigate to `http://localhost:80` in your web browser to access Wordpress. Navigate to `http://localhost:80` in your web browser to access WordPress.
![page](output.jpg) ![page](output.jpg)
@ -58,7 +66,7 @@ Stop and remove the containers
$ docker-compose down $ docker-compose down
``` ```
To remove all Wordpress data, delete the named volumes by passing the `-v` parameter: To remove all WordPress data, delete the named volumes by passing the `-v` parameter:
``` ```
$ docker-compose down -v $ docker-compose down -v
``` ```

@ -1,6 +1,9 @@
services: services:
db: db:
image: mysql:8.0.19 # We use a mariadb image which supports both amd64 & arm64 architecture
image: mariadb:10.6.4-focal
# If you really want to use MySQL, uncomment the following line
#image: mysql:8.0.27
command: '--default-authentication-plugin=mysql_native_password' command: '--default-authentication-plugin=mysql_native_password'
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql

Loading…
Cancel
Save