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>
This commit is contained in:
Guillaume Lours 2021-11-08 11:41:35 +01:00 committed by GitHub
parent d48e8350ea
commit 4bba832f88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 3155 additions and 5800 deletions

View File

@ -20,7 +20,10 @@ services:
ports:
- 80:80
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).
@ -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.
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

View File

@ -7,7 +7,10 @@ services:
environment:
ACCEPT_EULA: "Y"
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
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P example_123 -Q 'SELECT 1' || exit 1"]

View File

@ -46,7 +46,7 @@ After the application starts, navigate to below links in your web browser:
* Elasticsearch: [`http://localhost:9200`](http://localhost:9200)
* 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
```

View File

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

View File

@ -24,7 +24,10 @@ services:
build: backend
...
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:
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.
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
```

View File

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

View File

@ -1,17 +1,21 @@
services:
backend:
build: backend
restart: always
secrets:
- db-password
depends_on:
- db
environment:
- ASPNETCORE_URLS=http://+:8000
depends_on:
db:
condition: service_healthy
# depends_on:
# db:
# condition: service_healthy
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'
restart: always
healthcheck:

View File

@ -21,7 +21,10 @@ services:
build: backend
...
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:
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.
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
```

View File

@ -1,6 +1,9 @@
services:
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'
restart: always
healthcheck:

View File

@ -24,7 +24,10 @@ services:
build: backend
...
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:
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.
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
```

View File

@ -7,7 +7,10 @@ services:
db:
condition: service_healthy
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'
restart: always
healthcheck:

View File

@ -7,11 +7,7 @@ exports.connect = (app) => {
const options = {
useNewUrlParser: true,
autoIndex: false, // Don't build indexes
reconnectTries: 30, // Retry up to 30 times
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,
maxPoolSize: 10, // Maintain up to 10 socket connections
};
const connectWithRetry = () => {
@ -24,7 +20,7 @@ exports.connect = (app) => {
app.emit("ready");
})
.catch((err) => {
console.log("MongoDB connection unsuccessful, retry after 2 seconds.");
console.log("MongoDB connection unsuccessful, retry after 2 seconds.", err);
setTimeout(connectWithRetry, 2000);
});
};

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -27,7 +27,10 @@ services:
- 9230:9230
...
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:
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.
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
```

View File

@ -28,7 +28,10 @@ services:
depends_on:
- 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'
restart: always
secrets:

View File

@ -23,7 +23,10 @@ services:
build: backend
...
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:
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.
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
```

View File

@ -13,10 +13,13 @@ services:
db:
condition: service_healthy
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:
MYSQL_DATABASE: example
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
image: mysql:8.0.19
- MYSQL_DATABASE=example
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]

View File

@ -22,13 +22,21 @@ services:
ports:
- 8080:8080
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`.
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.
> **_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
```

View File

@ -6,7 +6,10 @@ services:
secrets:
- db-password
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
secrets:
- db-password

View File

@ -1,5 +1,5 @@
## 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).
## 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).
Project structure:
@ -13,7 +13,10 @@ Project structure:
```
services:
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:
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.
> **_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
```
@ -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
```
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)
@ -58,7 +66,7 @@ Stop and remove the containers
$ 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
```

View File

@ -1,6 +1,9 @@
services:
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'
volumes:
- db_data:/var/lib/mysql