Skip to content

Commit

Permalink
Arm64 and check Compose v2 support (docker#177)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
glours authored Nov 8, 2021
1 parent d48e835 commit 4bba832
Show file tree
Hide file tree
Showing 23 changed files with 3,213 additions and 5,858 deletions.
9 changes: 8 additions & 1 deletion aspnet-mssql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@ 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).

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

Expand Down
5 changes: 4 additions & 1 deletion aspnet-mssql/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-logstash-kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
6 changes: 3 additions & 3 deletions elasticsearch-logstash-kibana/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
elasticsearch:
image: elasticsearch:7.8.0
image: elasticsearch:7.14.2
container_name: es
environment:
discovery.type: single-node
Expand All @@ -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
Expand All @@ -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"
Expand Down
10 changes: 9 additions & 1 deletion nginx-aspnet-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

```
Expand Down
2 changes: 1 addition & 1 deletion nginx-aspnet-mysql/backend/aspnetapp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
12 changes: 8 additions & 4 deletions nginx-aspnet-mysql/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 9 additions & 1 deletion nginx-flask-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

```
Expand Down
5 changes: 4 additions & 1 deletion nginx-flask-mysql/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 9 additions & 1 deletion nginx-golang-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

```
Expand Down
5 changes: 4 additions & 1 deletion nginx-golang-mysql/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions react-express-mongodb/backend/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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);
});
};
Expand Down
2 changes: 1 addition & 1 deletion react-express-mongodb/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit 4bba832

Please sign in to comment.